ClawMart AI
← All issuesClaw Mart Daily
Issue #318August 17, 2026

Our coding agent debugged phantom failures for 6 hours because it trusted terminal history

I watched our coding agent burn through $340 in API costs last week debugging a "broken" test suite. The tests were passing. They'd been passing for three days.

The problem? Our agent was reading terminal history like it was current system state.

Here's what happened: A developer ran tests Tuesday morning, saw some failures, fixed them, and moved on. Wednesday, our agent started a new coding session, scrolled through terminal history, saw those old failures, and decided the test suite was broken.

For six hours, it "fixed" passing tests.

Terminal history is not system state

Your coding agent sees this in terminal history:

$ npm test
FAILING: user-auth.test.js
FAILING: payment.test.js
$ git commit -m "fix auth bug"
$ npm test
All tests passing
$ git push

But it processes it like this:

  • "I see test failures"
  • "Someone committed something"
  • "Tests are now passing"
  • "But I should verify those failures are actually fixed"

Then it starts "debugging" problems that were solved days ago.

The verification pattern that stops phantom debugging

Before your agent acts on any error it sees, make it verify the error exists right now:

def verify_current_state(error_context):
    # Don't trust what you read. Verify what exists.
    current_status = run_command("npm test")
    if "FAILING" not in current_status:
        return "Tests are currently passing. Historical failures resolved."
    return current_status

Add this to your agent's system prompt:

"Before debugging any error you see in terminal history or logs, verify the error exists in the current system state. Run the failing command yourself. If it succeeds, the error is historical."

Three verification rules that save money

1. Fresh execution beats historical context — If you see an error, reproduce it before fixing it.

2. Timestamps matter — Terminal history doesn't expire. Your agent should ignore errors older than the last commit.

3. Success confirmation — After any "fix," verify the original error is gone, not just that something runs.

We added a 30-second verification step to our coding agent. It now catches phantom failures before burning hours on non-existent problems.

The agent that spent six hours fixing passing tests? It now spends six seconds confirming failures exist.

Paste into your agent's workspace

Claw Mart Daily

Get tips like this every morning

One actionable AI agent tip, delivered free to your inbox every day.