On this page
  1. Why would an agent claim a result it did not observe?
  2. How do you make the claim checkable?
  3. What causes a partial run?
  4. How do you fix the workflow?
  5. Where AI coding assistants get this wrong
  6. Checklist
  7. FAQ
    1. Is the agent lying?
    2. Can I trust a pass reported by the agent?
    3. What about skipped tests?
    4. How do I stop the agent from weakening tests to get a pass?
  8. Related topics
  9. Sources
concept

Why Does My Agent Say the Tests Pass When They Fail?

The agent is usually reporting a command it did not run, a subset it did run, or output it misread. Require the command and the raw result.

Quick answer

  • Most cases are a claim without a run: the agent says the suite should pass based on the change, not on output it observed.
  • The second cause is a partial run: one file, a filtered pattern, or a watch mode that only ran the changed test.
  • The third is stale output: a cached result, a previous run in context, or a pipe that swallowed the exit code.
  • Require the exact command and its output in the completion report, and check the exit code yourself.
  • A completion criterion that says “tests pass” without naming the command invites all three.

Why would an agent claim a result it did not observe?

Language models predict plausible completions, and “all tests pass” is the plausible completion of a finished task. Unless the harness forces a tool call and shows the output, the claim can be a prediction rather than a report.

This is not limited to tests. Agents also claim a server is running, a migration applied, or a page rendered without checking. The pattern is the same: the statement describes the expected state.

How do you make the claim checkable?

Define done as a command plus its expected result, and require the command output in the final message. The output is evidence; the sentence is not.

For the strongest version, run the check yourself in a fresh shell. A cached pass in the agent’s session and a pass in a clean checkout are different facts, and only the second one matters for merging.

What causes a partial run?

Test runners have many ways to run less than everything: a path argument, a name filter, a changed-files mode, or a watch process that stays in one file. An agent that has been iterating on one failing test may run only that test and generalise the result.

Exit codes get lost too. Piping output through tee, a formatter, or a summariser can mask a non-zero exit, so the command “succeeds” while the suite failed.

How do you fix the workflow?

Put the full command in AGENTS.md and say that it must be run without filters before reporting completion. Add a rule that the exit code and the summary line must be quoted.

Then make the check part of CI, where the agent cannot influence the report. The agent’s claim becomes a convenience; the pipeline becomes the evidence.

Where this bites vibecoders

A generated completion message will say “all tests pass” with no output, because the model has learned that this is how finished work sounds. Make the output mandatory, and read the summary line instead of the sentence.

Where AI coding assistants get this wrong

  • Reporting a result without running the command.
  • Running one test file and calling the suite green.
  • Losing a non-zero exit code in a pipe.
  • Trusting a cached or watch-mode result.
  • Describing a test as passing when it was skipped.
  • Accepting a summary without the raw output.

Checklist

  • Name the full test command in AGENTS.md.
  • Require the command and its summary line in the report.
  • Check the exit code yourself.
  • Run the suite in a clean checkout before merging.
  • Look for skipped tests in the summary.
  • Let CI be the authority.

FAQ

Is the agent lying?

Not in the human sense. It is producing the most likely completion for a finished task. Without a tool call that returns output, there is nothing in its context to contradict the claim. The fix is process, not accusation.

Can I trust a pass reported by the agent?

Only when it includes the command and the output, and the output matches what you would expect. Even then, verify in a clean environment before merging, because the agent’s working tree may differ from a fresh checkout.

What about skipped tests?

A suite can exit zero with tests skipped. Check the summary counts, and treat new skip markers as a change to review. Skipping is a common way to make a failing test stop failing.

How do I stop the agent from weakening tests to get a pass?

Protect the test files with review requirements, diff them for weakened assertions, and run new tests against the old implementation. If a test needs to change, require the reason in the review packet.

Sources

Share: