Agents That Never Error Are the Scariest: 10 runtime pitfalls from 6 months of building a coding agent
Anyone building agents that run unattended will hit these same silent failure modes: the model isn't the weak link, the plumbing around it is. The fixes here translate directly into cheaper, more reliable agent pipelines for Western teams, especially around tool result validation and context-window management.
Building a Claude Code-style terminal agent on DeepSeek, the author logged 129 bug-fix commits out of 359 total over six months. The recurring lesson: when an agent goes wrong, it usually doesn't throw an error. It streams output, calls tools, and says "done" while quietly producing wrong results.
The article catalogs 10 distinct failure modes, each with a deceptively normal surface. A tool that "spins forever" was actually a missing end-of-execution signal. A cleared input box made the user believe a message sent, but the backend silently discarded it during generation. A model declaring "basically done" after half the work turned out to be early wrap-up from a too-loose ending rule. A command that failed still looked successful because the tool output lacked an exit code, and the model guessed success from output text alone.
Other pitfalls include a search tool used like a dictionary, wasting 20% of rounds and tripling token use; a model copying a malformed site: query because the guidance lacked an example; a directory tool silently returning the wrong tree, producing a three-layer lie chain; an approval system spamming 100+ confirmations due to a name mismatch; long tasks losing constraints during context compression; and a cache block that invalidated whenever any byte changed, dropping hit rate to 15%. Each fix is concrete: add sentinels and fallbacks, queue instead of reject, measure character counts instead of guessing semantics, provide copyable templates, unify names, split entity indices from narrative in summaries, and move variable content out of pinned cache blocks.
The article's core thesis is that agents fail silently because the model faithfully processes whatever it's given, including faulty tool outputs and misleading context; the pipeline is where lies originate.
A pattern emerges: nearly every pit traces back to the developer's own integration code, not the LLM. The author admits shifting focus from "training the model" to "repairing the pipeline", a framing that generalizes to any agent builder.
The nudge approach (inserting a note into context rather than interrupting or retrying) is a clever low-cost intervention, but its effectiveness depends on the model actually reading that note, which itself isn't guaranteed.
The cache-block pit is particularly insidious because it produces no visible malfunction; only cost monitoring catches it, suggesting agent cost observability is a prerequisite for production use.
The 15% to 99.8% cache hit rate improvement shows how small design decisions about content ordering can dominate token costs.
It's truly scary when there is no error—the program just spins around doing nothing, and you don't even know where to start looking. The exit-code sentinel trick is solid; that's how you strangle the success hallucination.