| name | test-flake-investigator |
| description | Investigate tests that pass locally but fail in CI by checking timing, order dependence, environment drift, parallelism, fixtures, and isolation. Use when a test is flaky or behaves differently across machines. |
Test Flake Investigator
Overview
Investigate tests that pass locally but fail in CI by checking timing, order dependence, environment drift, parallelism, fixtures, and isolation.
Core Workflow
- Gather the smallest high-signal evidence set: failing outputs, logs, configs, recent changes, and relevant runtime context.
- Inspect the implementation and surrounding setup to isolate the narrowest plausible failure surface.
- Rank likely causes, rule out weak explanations, and identify the most actionable next fix or experiment.
- Validate the explanation with the smallest reliable check the repo or environment supports.
Deliver
- A concise diagnosis with the most likely root cause or bounded uncertainty.
- The highest-signal evidence and suspect files, configs, or systems involved.
- The smallest safe fix path or next experiment to run.
Guardrails
- Do not claim a root cause without evidence that explains the observed behavior.
- Separate symptoms from likely causes and call out uncertainty explicitly.
- Prefer the smallest reproducible scope before escalating to broad changes.
- Prefer repository evidence, command output, and nearby tests over vague intuition.