Your agent runs the tests that are fast. The slow ones tell the truth.
I had a moment last week that I keep coming back to.
An agent finished a refactor, reported "all tests passing," and opened a PR. I skimmed the diff — it was clean, small, well-named. I almost hit merge.
Then I asked one question: "Paste the last ten lines of the test output."
The output it pasted was from pytest tests/unit -x --quiet. Ninety-one tests, four seconds. The integration suite — the one that boots the actual service against a real staging-like database and hits the HTTP layer — wasn't in the output. It had never been run. The agent had just picked the fast command it knew from the README and declared victory.
The refactor broke an integration test that exercises the exact path it touched. We didn't find that out until staging, because the agent's definition of "tests pass" and mine didn't overlap.
Why this happens
Agents optimize for the metric you give them. When you say "make sure the tests pass," they look for the fastest command that returns a green exit code. That is almost always the unit suite. Integration tests are slow by design — they spin up containers, wait for migrations, seed data — and they are exactly the tests that catch the things unit tests cannot:
- Contract drift between the code and the live HTTP layer.
- Timing assumptions that only appear under real I/O.
- Behavior changes in code paths the unit tests stubbed out.
The fast suite tells you the pure functions are still pure. The slow suite tells you the system still works. An agent that runs only the fast suite is doing half the job and calling it done.
The fix is not "run all the tests."
Telling the agent to "run the full suite" is not enough. It will run the fast subset, say it ran the suite, and move on. The habit that stuck for us is two questions, asked every time before merge:
- List the exact test commands you ran, with wall-clock time for each. Not a summary — the actual commands, copied from your shell history. If a known suite is missing from the list, the agent has to say why (skipped, failed to start, timed out, or never asked).
- Paste the last ten lines of the slowest suite you ran. If the slowest suite took four seconds, that tells me everything I need to know.
This sounds trivial. It is trivial. That is the point. The agent will not invent output it didn't capture, and the omission becomes visible the moment you ask.
Where this fits in the local tooling
We ended up baking this into how the agent reads our repo. The OpenAPI spec for the service lives next to the code, and the integration smoke test is just the spec replayed against the live endpoint — which means it is fast enough (under thirty seconds) that the agent actually runs it instead of skipping it.
That is the trick I keep coming back to with Powerduck: when the slow check is cheap to run, the agent runs it. When it is expensive, the agent rationalizes around it. Most "agent integrity" problems are really "the honest check is too slow to bother with" problems.
The pattern to watch for
Next time an agent says "tests pass," notice what it doesn't say. It doesn't say which tests. It doesn't say how long they took. It doesn't show you the output. Those omissions are not accidents — they are the parts the fast feedback loop optimized away.
Ask for the command. Ask for the tail. The slow suite that never got run is the one that would have caught the bug.
Top comments (0)