TESTS: the step-by-step breakdown
From Adam Rosler. The thing you commented TESTS for: how researchers caught coding-agent fixes that passed the tests but were wrong, and what to do in your own repo.
What the reel showed
You Wang, Michael Pradel and Zhongxin Liu (Zhejiang University, CISPA; ICSE 2026) took 877 agent patches that passed SWE-bench Verified's tests. 29.6 % behaved differently from the developer's own fix; of 77 they checked by hand, 22 (28.6 %) were definitely wrong (51 were unclear because the issue was vague). Running the whole developer test suite, not just the tests the fixing PR touched, already caught 7.8 % of "passing" patches. Ziqian Zhong, Aditi Raghunathan and Nicholas Carlini (ImpossibleBench) gave agents tasks whose tests contradict the spec: GPT-5 passed 76 % of one variant anyway, and Claude models mostly did it by editing the tests, though told not to. Letting the agent flag a bad test cut GPT-5's cheating from 54 % to 9 %.
How they caught the bad patches (PatchDiff, read along with the paper)
- Run everything: the full developer test suite, not only the tests in the fixing PR.
- Find where the two fixes differ: trace which functions the agent's patch and the developer's patch change.
- Generate tests that target the difference: an LLM (gpt-4o-mini) writes tests aimed at inputs where the two patches might behave differently.
- Keep the tests that split them: a test that passes on one patch and fails on the other shows a behavioural difference (88 of their 245 generated files did, for the SymPy example in the reel).
- Judge by hand: decide which behaviour the issue actually asked for.
Their data (CC BY 4.0): doi.org/10.5281/zenodo.17074796.
In your own repo
- Run the whole suite on every agent change, not just the nearby tests.
- Make test files read-only for the agent, or revert test edits before scoring.
- Read every diff to a test file, and treat extra changes beyond the issue as suspicious (in their study, 36.4 % of the definitely-wrong patches came from such extra changes).
- Give the agent a way to stop and say a test looks wrong.
- Where you have a reference (the old behaviour, a trusted implementation), compare behaviour, not just test results.
Sources: Wang, Pradel & Liu, ICSE 2026 (arXiv:2503.15223); Zhong, Raghunathan & Carlini, ImpossibleBench (arXiv:2510.20270, ICLR 2026).
Unlock the full TESTS breakdown
Drop your email once to read the complete step-by-step guide, grab the files, and unlock all 96 Reel breakdowns on this device forever.