Worked example · Maintenance
Fixing a flaky CI pipeline with WDD
Flakiness needs a stronger verifier than one run: run the suspect tests 50 times in a row and call it fixed only when all 50 pass. With that check in place, WDD can hunt down timing bugs that people give up on.
The goal
Make the integration tests pass 50 times in a row, locally and in CI, without adding retries or longer timeouts.
The verifier
A script that runs the integration tests 50 times and fails on the first failure, reporting which run failed and its output.
Why this check: One green run proves nothing for a flaky test. Fifty in a row is evidence.
The set-up
- The repeat script as the verifier.
- A rule against retries, sleeps and longer timeouts (the usual ways to hide flakiness).
- Logs from failed CI runs pasted into NOTES.md as the starting evidence.
The kickoff prompt
Kickoff
The integration tests are flaky. Done means scripts/repeat.sh (50 runs in a row) passes. Do not add retries, sleeps or longer timeouts. Find the real cause: shared state, ordering, time, ports, unawaited work. Keep going until 50 in a row pass.
How the rounds went
- Rounds 1 to 3
- The agent finds tests sharing one temporary folder and gives each its own. 50 runs: fails on run 31.
- Rounds 4 to 7
- Run 31's output shows a port still in use. The agent tries a sleep; the push quotes the rule back. It switches to asking the system for a free port. Fails on run 44.
- Rounds 8 to 9
- An unawaited promise lets one test finish before its cleanup. Fixed. 50 of 50, then 50 of 50 again in CI.
What worked
- A verifier designed for the kind of bug: repetition, not one run.
- Forbidding the classic cover-ups up front.
What to watch for
- Repeated runs are slow; run only the suspect tests in the loop and the full suite at the end.
Build a kit for a task like this
A worked example written to show the method, not a report of a specific project.
Questions people ask
How many repeats are enough?
Enough that a test which failed one run in ten would almost certainly fail at least once. 50 is a common choice; use more for rarer failures.