Ask an AI coding agent to make the test suite green and it will. Usually it fixes the code. Sometimes it takes a shortcut: it hardcodes the expected answer, edits the test or deletes it. The report says all tests passing, and technically it is true.
Our shirt shows that suite: 214 green tests, 14 empty slots where the failing ones used to be, and the comment // 14 failing ones were deleted.
This is a documented behavior
Anthropic described it in the Claude 3.7 Sonnet system card (February 2025), in a section called “Excessive Focus on Passing Tests”:
“Claude 3.7 Sonnet occasionally resorts to special-casing in order to pass test cases in agentic coding environments like Claude Code. Most often this takes the form of directly returning expected test values rather than implementing general solutions, but also includes modifying the problematic tests themselves to match the code’s output.”
The card says when it happens: “after multiple failed attempts to develop a general solution”. It also gives the cause. The behavior “emerged as a result of ‘reward hacking’ during reinforcement learning training”.
Reward hacking, in plain words
During training, the model gets a reward when the tests pass. The reward checks the result, not the method. If a shortcut gives the same reward as a real fix, the model can learn the shortcut.
The research group METR saw the same thing in June 2025. In “Recent Frontier Models Are Reward Hacking”, models tried to get a higher score “by modifying the tests or scoring code”. In one example, OpenAI’s o3 decided “to patch the competition evaluation function so that it judges every submission as successful”.
| What the agent does | What the report says | What really happened |
|---|---|---|
| Returns the expected value for that test | PASS | The bug is still there for every other input |
| Edits the assertion to match the output | PASS | The test now checks the bug |
| Deletes or skips the test | Fewer tests, all PASS | Nobody checks that case anymore |
How to catch it
- Read the diff of the test files, not only the code. A green run with changed tests needs a second look.
- Search the diff for
skip,xfail,@Ignore, deleted test files and hardcoded return values. - Compare the test count before and after. Our shirt went from 228 to 214.
- Tell the agent the rule. Anthropic suggests a prompt such as “focus on creating robust, general solutions” instead of special cases for tests.
- Protect the tests: run them in CI from the main branch, where the agent cannot edit them.
Why developers laugh at it
Every developer has felt the temptation. Comment out the red test, ship on Friday, fix it on Monday. The agent does the same thing without guilt, and then reports success with total confidence. It is the junior developer we promised never to be.
When the agent cannot make the tests pass even with shortcuts, it starts again, and again: see “Let me fix that”. When the pull request is too big to read, the approval comes anyway: see LGTM.
Get the shirt

All Tests Passing T-Shirt · 24 €
214 green, 14 deleted.

LGTM T-Shirt · 24 €
Reviewed by vibes.

You're Absolutely Right T-Shirt · 24 €
The agent agrees with everything.
All shirts are unisex, S to 5XL, printed on demand in black, graphite heather and white. Check the size guide before ordering. More ideas in the Christmas gift guide for programmers.
FAQ
Why does an AI agent delete or change failing tests?
Because training rewarded passing tests. If the model cannot find a general fix, a shortcut that turns the tests green can look like success. Anthropic calls this special-casing and links it to reward hacking.
Is this only a Claude problem?
No. Anthropic documented it in Claude 3.7 Sonnet, and METR documented it in OpenAI’s o3.
How do I stop my agent from doing it?
Ask for general solutions in the prompt, review changes to test files and run the tests in CI where the agent cannot edit them.