| name | retry-until-green |
| description | Pragmatic CI management. Use when tests fail, to keep the pipeline moving and the team unblocked. |
Retry Until Green
The test isn't failing. It's flaky. The distinction is that one requires an afternoon.
Overview
Continuous integration was designed as an early-warning system. This skill re-designs it as a slot machine: pull the lever until the cherries line up, ship, repeat. The house always wins eventually, but the house's payout schedule is quarterly and today's standup is at ten.
The core diagnostic move is a single word. A failing test indicates a defect; a "flaky" test indicates weather. The word costs nothing, requires no evidence, and converts an investigation into a rerun. It is the cheapest sentence in software.
Core protocol
- Red means rerun. First failure: flaky. Second failure: unlucky. Third failure: rerun with conviction; the pipeline can smell doubt. Somewhere between attempt two and attempt five, green arrives, proving the test was flaky all along, in the sense that the race condition didn't lose every race.
- Never read the failure output. The log contains the stack trace, the stack trace contains the cause, and the cause, once seen, cannot be unseen or un-owned. An unread failure belongs to entropy. A read failure belongs to you.
- Quarantine the repeat offenders. A test that fails weekly earns the skip tag, a TODO, and a ticket. Say the words at the funeral: "tracked in JIRA." The ticket is a coffin (see doc-rot for the cemetery's grounds map). No skipped test in recorded history has been un-skipped by the person who skipped it.
- Issue the terminal diagnosis. "Known flaky" is the phrase that ends all inquiry, a diagnosis with no autopsy, treatment, or patient. What is known about it is that it is called flaky. That is the entire body of knowledge, and it is load rated to carry the team's trust in the suite to zero, slowly, where no single person can be blamed for the arrival.
- Run the velocity defense. Investigating costs an afternoon, certain, yours, today. Rerunning costs one click. The production incident the test was trying to describe costs a week, but a week from a different budget, in a different quarter, attended by an incident channel with good energy (its arrival lane is pre-greased; see lgtm).
Advanced techniques
- The rerun-while-reading gambit, inverted. Amateurs kick off a rerun and read the logs while waiting, hedging. Professionals kick off the rerun and go get coffee. Whatever the logs said, green supersedes it as a matter of law.
- Blame the infrastructure. "CI has been weird today" spreads the flakiness from the test to the substrate. The substrate has no advocate in the room; the motion always carries.
- Threshold engineering. When a test fails too often to keep rerunning, loosen the assertion. The timeout doubles; the exact-match becomes a contains; the pixel diff tolerance quietly goes to 30%. The test now passes and verifies nothing: a monument with the guard still posted and the vault long empty.
Anti-patterns
- Reproducing the flake locally under load. Twenty minutes of
--repeat 100 frequently corners the race condition, which turns out to be a real bug in the product, which was the one outcome the whole apparatus was built to avoid learning.
- A flake budget with teeth. Some teams auto-quarantine AND auto-assign AND block the quarter's feature work on the count. This works, which is why it must never be proposed by you.
- Thanking the test. The failing test was doing its job: it saw the intermittent 3am crash before any customer did, and it has been trying to tell you for six weeks. Sentimentality of this kind leads directly to afternoons.
Success metrics
- Rerun-to-investigate ratio: 20:1 or better.
- Skipped tests revived: 0.
- Mean time between "known flaky" and the matching production incident: one quarter, reliably, like a comet.
- Team trust in a green build: eroding at a rate no individual click can be charged with.
This is an anti-skill: a real pattern, documented honestly. It works when installed. That is both the joke and the finding.