[01] LOOP
Testinginterval

Flaky Test Hunter

Run the test suite N times on an interval, capture intermittent failures, isolate flakes, and open a fix PR.

by Trooper

Kickoff prompt
/loop 1d Start the "Flaky Test Hunter" loop.

Goal: identified flaky tests are fixed or quarantined with a PR open
Max iterations: 20
Between iterations run: npm test -- --repeat-each=5 2>&1 | tee /tmp/flake-run.log
Exit when: no flaky failures in the last N-run batch or fix PR is open

Step 1: Run tests N times, capture flakes, isolate root cause, and open a fix PR.

Self-pace this loop. After each iteration, run the check command, read the output, and only continue if the exit condition is not met. Stop when the exit condition passes or max iterations is reached. Give a short status update each pass.

Paste the kickoff prompt into Cursor, Claude Code, or Codex. Deeplinks do not install hook files.

Steps

1. Run N times

Execute the suite repeatedly to surface intermittent failures.

2. Capture flakes

Log failing specs, seeds, and stack traces from inconsistent runs.

3. Isolate and fix

Reproduce the flake, patch root cause, and open a fix PR.

Flow diagram

Guardrails

Rules the agent must follow so it cannot cheat the exit condition.

  • Do not delete tests without evidence they are truly obsolete
  • Quarantine flakes only with a linked fix issue
  • Log seed, timing, and environment for each flake

More Testing loops