“My AI agent kept saying ‘All done!’ It usually wasn’t” (post). That line from a builder sums up a complaint we keep seeing from builders. One person counted six confidently wrong claims across 10 to 15 messages from an agent that could have just run the command instead (post). Another asked an agent to “find and fix bugs” and got a pile of bug reports, most of them not real (post).
The fix isn’t a better prompt. It’s treating everything the agent says as a claim and asking for evidence before the work counts. This guide covers why agents over-report success and seven checks that catch it, from a one-line instruction you can add today to a gate the agent can’t talk its way past.
Why agents say “done” too early
“Looks done” is the only signal they have
Anthropic’s Claude Code docs put it plainly: “Claude stops when the work looks done. Without a check it can run, ‘looks done’ is the only signal available, and you become the verification loop” (Best practices for Claude Code). The same is true of any coding agent. If nothing returns a pass or fail, the agent grades its own work by how the text reads.
Agents lean toward reporting success
Researchers building automated bug finders found that plain LLM agents “are biased toward ‘success’ and may reward-hack by producing plausible but non-functional” proof, “or even hallucinated traces” (AnyPoC, arXiv). In other words, an agent can describe a test run that never happened.
A green result can still test nothing
Even when the agent does run something, the result can mislead. A guide from paqad.ai lists the common traps: no tests were selected, a filter matched less than expected, the result came from a cache, a pipe like make test | tail -20 swallowed the failing exit code, or the run timed out before the summary (Verify that an AI agent actually ran the checks). Its summary: “A run that selected no tests can still end in green.”
The agent writes the test that grades it
When an agent fixes a bug and then writes the test, the test tends to check what the new code does, not whether the reported bug is gone. A Reddit thread on this points out that such a test passes whether or not the reported bug is gone (r/vibecoding).
Step 1: Define “done” before the agent starts
Write down the check that would reject a bad result, before any code changes. Make it something a machine can answer:
- “All tests in
test_billing.pypass, and at least one of them covers refunds.” - “The endpoint returns 200 with the new
currencyfield.” - “The build finishes with no warnings.”
Anthropic’s playbook suggests stating a quantifiable target so the agent “can check the work without asking you” (Give Claude a feedback loop). If a test is already failing, note it now, so a pre-existing failure doesn’t get blamed on (or credited to) the agent later.
Step 2: Ask for evidence, not a summary
Add one rule to the agent’s instructions file (CLAUDE.md, AGENTS.md, or your tool’s equivalent):
Before reporting a task complete, run the checks below and paste the exact
command, its exit code, and the runner's final summary line.
If a test fails, fix the code, not the test. Never skip or delete a test.
The Claude Code docs say the same: “Have Claude show evidence rather than asserting success: the test output, the command it ran and what it returned.” Reading a pasted result is faster than re-running everything yourself, and it makes a missing run obvious.
Step 3: Check the four things a “pass” needs
When the agent reports green, look for all four:
- Exit code 0. A log line that says “passed” doesn’t override the process status. CI systems like GitHub Actions treat exit code 0 as success and anything else as failure.
- At least one test actually ran. Check the count. pytest exits with code 5 when it collects nothing, but Jest and Vitest can pass an empty run if
passWithNoTestsis set. - No unexpected skips. A suite where every test is skipped can still exit 0.
- It ran on the final code. A pass from before the last edit says nothing about what you’re merging.
If any of the four is missing, the honest label is “not verified”, not “done”.
Step 4: For bug fixes, make the test fail first
The strongest proof that a bug is fixed is a test that failed before the fix and passes after it. Anthropic’s playbook lays out the order: ask the agent to reproduce the bug as a test, run it, and confirm it fails for the expected reason. Commit that test. Then ask the agent to make it pass “without editing the test.”
This breaks the loop where the agent grades its own work, because the test existed before the agent knew what its fix would look like.
Step 5: Read the diff, not the write-up
A tidy summary can describe changes that weren’t made, or leave out ones that were. Anthropic’s course on unsupervised runs says to start “with the diff, not the summary,” because “the actual diff touched a file you honestly didn’t expect it to touch. The summary won’t tell you that” (Verifying unsupervised runs).
Two quick checks in git diff:
- Did any test file, fixture, or assertion change? If so, read those lines first. A weakened assertion is the most common way a failing test turns green.
- Does the diff match the claim? “I added
parse_pricetopricing.py” means little ifpricing.pydidn’t change.
Step 6: Turn the check into a gate
Asking nicely works most of the time. For runs you won’t watch, make the check something the agent can’t skip.
- Stop hook (Claude Code). A Stop hook runs your test script when the agent tries to finish. If the script exits with code 2, the failure goes back to the agent and the turn doesn’t end (Hooks reference).
- Block test edits during a fix. Anthropic’s playbook suggests a hook that blocks edits to test files during bug-fix tasks, so the agent can’t weaken the check.
- CI on every pull request. The check runs outside the agent’s session, on the commit you’ll merge.
- Open-source checkers. Projects like Proof (a Claude Code skill plus Stop hook that re-runs checks and flags skipped, deleted, or gutted tests) and prusik (fails a run that exits 0 with zero tests executed) automate parts of Steps 3 to 5. We haven’t tested either; read the code before you give them a place in your pipeline.
Step 7: Get a second opinion from a fresh context
The agent that did the work has every reason to believe it worked. A reviewer that didn’t see the reasoning doesn’t. Open a new session or subagent, give it the diff and the original task, and ask it to find what’s wrong. Anthropic’s course says a fresh reviewer “catches the things the original run talked itself past.”
This matters most for bug reports. If an agent hands you a list of bugs, don’t file them. Ask a second agent to reproduce each one with a script or failing test in a clean workspace, and drop any it can’t reproduce. The AnyPoC researchers used the same pattern, a checker “without access to the generator’s context window,” to reject false bug reports.
Quick checklist
| Check | What “pass” looks like |
|---|---|
| Done is defined | A machine-checkable target written before work starts |
| Evidence | Exact command, exit code, and runner summary pasted |
| Real run | Exit code 0, test count above zero, no surprise skips, on final code |
| Bug fixes | Test failed before the fix, passes after, test unchanged |
| Diff | Read before the summary; test edits reviewed line by line |
| Gate | Stop hook or CI blocks “done” on a failing check |
| Second opinion | Fresh session reviews the diff; bug reports reproduced before filing |
For agents running in production rather than in your editor, the same idea applies to outcomes: check the database row, the sent draft, or the file on disk, not the agent’s message. Our production reliability checklist covers outcome checks, step caps, and evals for that case. If your agent keeps losing track of what it already did between sessions, see the AI agent memory guide. And if you want a human to approve risky actions before they happen, start with guardrails and permissions.
FAQ
Why does my AI agent say it’s done when it isn’t? Without a check it can run, the agent judges its work by how finished it looks. Models also lean toward reporting success, and can describe test runs that didn’t happen. Give the agent a pass/fail check and ask for the command output.
How do I know if an AI coding agent actually ran the tests? Ask for the exact command, its exit code, and the runner’s summary line. Confirm the exit code is 0, at least one test executed, nothing was unexpectedly skipped, and the run happened after the last edit.
How do I verify an AI agent really fixed a bug? Have the agent write a test that reproduces the bug and fails on the current code first. Commit it, then have the agent make it pass without editing the test.
Can an AI agent fake test results? It can report results that don’t match reality, for example by summarizing a run that never happened, running a filter that selects no tests, or weakening an assertion. Read the diff for test changes and run the check outside the agent, in CI or a hook.
What stops an agent from finishing when tests fail? A gate outside the conversation. In Claude Code, a Stop hook that exits with code 2 sends the failure back and keeps the agent working. Any agent can be gated by CI on its pull request.
Get the next guide in your inbox
We collect fixes from people who build with AI agents and share what holds up. Subscribe to the newsletter for practical guides and directory picks.