1. Front page
  2. Playbooks
  3. Flaky test hunt
Playbooks · Code

Flaky test hunt

When a test fails at random, the agent reruns it, finds the pattern and proposes a fix on a branch.

Paste this into your agent

When a test fails in CI and then passes on a rerun, record it. Run the suspect test in isolation enough times to confirm it is flaky, then look for the cause, such as timing, shared state or test order. Propose a fix on a new branch, with a pull request laying out the evidence. Do not disable, skip or delete tests, and do not merge or push to the main branch.

What the agent does

  1. Spot tests that fail and then pass

  2. Rerun the suspect test in isolation

  3. Trace the cause of the flakiness

  4. Open a pull request with the fix and the evidence

Rules to add

  • Changes go on a branch and wait for review
  • No disabling, skipping or deleting tests
  • No new packages without your approval

What you end up with: Flaky tests found, explained and fixed in a pull request you can review.