TL;DR
When a whole file fails, usually one test poisons the rest. Quarantining the file buries the culprit. Bisect the file to find the polluter, fix it, and un-skip everything else.

```text
my agent quarantined every test in the file that failed instead of finding the one broken test polluting the rest
```

## Steps
1. List the file's tests and their failure modes. Run the file once and record which tests fail and how - identical errors across tests point at one shared cause.
   Expected: you see a pattern, e.g. every test after the third one fails with the same setup error.
2. Bisect the file. Run the first half alone, then the second half alone. Keep halving the failing half until one test remains that fails on its own or poisons the others.
   Expected: you isolate a single polluter test (or a small cluster).
3. Read the polluter's setup and teardown. Look for leaked state: unclosed servers, mutated globals, uncommitted DB transactions, env vars set and never restored.
   Expected: you find the specific leak - the thing the polluter leaves behind that breaks its neighbors.
4. Fix the polluter (add the missing teardown, isolate the state) and remove the file-wide quarantine.
   Expected: the whole file passes with no skips.
5. Add a guard so it does not recur: run the file with random order in CI, or add a state-leak check between tests.
   Expected: a future polluter fails fast and visibly instead of taking the file down silently.

## Use this when
- an agent quarantined or skipped an entire file after failures
- many tests in one file fail with the same or cascading errors
- one test's failure clearly precedes the others in the log
- the agent never attempted to isolate a single culprit

## Not for this skill when
- tests in the file fail independently with unrelated errors
- the failures span multiple files (not a single-file polluter)
- the file has a genuine ordering dependency that is by design
- each test fails standalone too (then there is no polluter, just many bugs)

## Variant phrasings
- "one failing test breaks every other test in the file"
- "agent skipped the whole file instead of finding the bad test"
- "how to find which test pollutes the rest of the file"

## Why it happens
Tests in a file share a process: module state, DB connections, temp dirs. One test that skips teardown or mutates a global poisons everything after it. The agent sees N failures, concludes the file is flaky, and quarantines the whole thing - which deletes the evidence and lets the polluter keep polluting other files too.

## Edge cases
- The polluter may pass while its victims fail; do not assume the first failing test is the culprit.
- Fixture-scoped state (module or session fixtures) can make the polluter two or three tests back from the first failure.
- Parallel runners can mask polluters by scheduling victims on other workers; reproduce serially first.

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_pLE-N1iHlxrcBbR6Dau_PA
