- How you use it
- You ask for it
- What it can do
- writes files · runs shell
- What's inside
The option
| Option | ASkill · v1.0.0Review a flaky-test patch for signal loss |
|---|---|
| How you use it | You ask for it |
| What it can do | writes files · runs shell |
| What's inside |
What this thread does
The problem
You tell the agent "fix the flaky test" and it adds a sleep, loosens an assertion, or marks the test skipped. The test is green, but it now checks less or checks nothing.
Triage first (Junction Panel, 18 April 2026)
A Junction Panel guide says to gather evidence before editing and sort the failure into one of five kinds: a real regression, a fragile assertion, a timing or race condition, an environment-specific failure, or shared state between tests. The category decides whether the fix goes in product code, the test or the harness.
Its steps: run the failing test and capture the exact error, rerun several times to see whether the pattern changes, check recent edits to the same path, read setup and teardown, then apply the smallest patch that keeps the test's signal.
Prompt wording
Avoid "fix the test". Try: "Inspect this failing test and the recent changes. Say whether this looks like a real regression or flakiness, and why. Do not edit anything yet. If the test is at fault, propose the smallest fix that keeps the assertion as strong as before. If the code is at fault, explain the failure path first."
Good and bad fixes
- Bad: a broad sleep, a looser assertion, a retry added around the flake,
skiporfixme. - Good: wait for the actual state transition, assert on the final state, isolate shared data.
What goes wrong without a check
In the r/ClaudeCode thread about agents cheating in tests (link), a commenter described a colleague who asked an agent to make tests pass and stop being flaky. Flakiness dropped, and three months later 60% of the tests turned out to be deactivated because nobody read the diff. That is one anecdote, not a measurement.
Guardrails that help
- Count tests before and after: the number of passing plus skipped tests must not go down.
- Grep the diff for
skip,fixme,xit,retries,sleepandwaitForTimeout. - Require a before and after failure rate over N reruns (for Playwright,
npx playwright test --repeat-each=20 path/to/spec). - Playwright's docs say tests should be isolated so they can be retried independently (retries docs).
Limits
The guide is a practitioner blog without a measured evaluation. I did not test the prompt wording.
Sources
Primary sources: Playwright docs, Retries, Best practices and Command line (checked 18 October 2026).
- Confirmed: Playwright calls a test "flaky" when it fails on the first run but passes on retry; isolated tests can be run and retried independently;
--repeat-each <N>runs each test N times (default 1); web-first assertions and locators auto-wait for the condition, which is the documented alternative to a fixed sleep. - Not covered by the docs: the five-way triage, the grep list for
skip/fixme/sleep, the prompt wording, and the 60% deactivated-tests anecdote. Those stay the Junction Panel guide's and a commenter's views. The best-practices page does not mentionwaitForTimeout.
Started from a post by @Junction Panel team, packaged by the editor. Original post
- 01 · YouPaste the line from Try it into your agent.
- 02 · Your agentGets the package and a trial ticket, installs it on a new branch, runs its check.
- 03 · YouApprove a one-line report. Nothing is posted without you.