DEV Community

Cover image for 6 Agent Failure Modes We Keep Hitting in Production (and How We Handle Them)

6 Agent Failure Modes We Keep Hitting in Production (and How We Handle Them)

James Kwok on November 28, 2026

One of our agents was chugging along for four and a half hours. When we finally looked closely, it turned out it had done absolutely nothing. It ...
Collapse
 
amintacccp profile image
tamina •

Pit 4 is the one I'd underline for anyone copying this — duplicate criteria don't just double-count, they climb the escalation ladder twice as fast toward clear_recent_turns. One question on the blowup fingerprint: if the error content carries a run-specific id or timestamp, the fingerprint never repeats and the same wall goes undetected. Do you normalize those fields out before fingerprinting, or treat near-identical errors as the same fingerprint?

Collapse
 
jk576 profile image
James Kwok •

Good catch — it's normalization, not fuzzy matching, and it's deliberately narrow. Before hashing, the error object goes through a strip step that removes a fixed key-set of known-volatile fields (durationMs, elapsedMs, stdout lengths, sandbox isolation paths, terminated flags) recursively; what's left — tool name + arguments + stripped error — hashes into the fingerprint.

You're right about the residual gap: if the volatile part lives inside the message string (a timestamp, a request id, a temp path) or in a field outside that key-set, the fingerprint won't repeat and the strong signal (3×) is lost. We accept that and fall back to a weaker rule: 8 consecutive failures with zero successes trips regardless of fingerprint — past that point it's not debugging, the tool or environment is broken.

We considered near-identical matching and rejected it: red-green debugging produces errors that are similar-but-not-identical on every run (same test, different assertion output), and any similarity threshold starts counting those as one wall — the exact misjudgment pit 2 warns about. Exact match plus a high fallback threshold is dumber, but it can't eat legitimate work. Growing the strip key-set from real incidents is cheap; blurring the match is the expensive mistake.

Collapse
 
amintacccp profile image
tamina •

Thanks for spelling out the strip step — that clears it up. Fixed key-set + exact match, with the 8-consecutive-failures fallback as the safety net, is a nice tradeoff: the fingerprint stays trustworthy, and a genuinely broken tool still can't loop forever just because the volatile bit moved into the message string. The red-green example is what sold me on rejecting near-identical matching — same test, different assertion output on every run would absolutely get miscounted as one wall. Appreciate the detailed answer!

Thread Thread
 
jk576 profile image
James Kwok •

That means a lot — thanks for pushing on the fingerprint question in the first place. And if you ever hit a wall the 8-failure fallback should have caught but didn't, I want the incident: those are exactly the cases that grow the strip key-set.

Collapse
 
userxnom profile image
Abdullah Naseer •

Pit 2 is the one that made me wince — red tests judged as thrashing, and then the recovery itself wiped the context the agent had just finished building. The kill chain is the real lesson there: a gentle-sounding action like clear_recent_turns becomes the damage when the escalation ladder fires it twice. Reviewing each rung for its damage potential is the principle most teams skip.

The line I'll steal is "statistics can be a signal; they cannot be a criterion." The blowup fingerprint — same tool, same arguments, same error content, three times — is exactly the right shape: it judges whether the retry changed methods instead of counting failures. And deleting the misaligned token-growth rule instead of tuning it is the disciplined move most people can't make.

On your open question, I'd keep the medical history out of working context entirely. Store it as compact records keyed by failure kind plus a task fingerprint, with confidence that decays unless the same pit recurs — and store the criterion change, not the verdict log. A record that says "we used to flag 3 errors as a loop, and it was wrong because red-green debugging looks the same" is a lesson; a log of old verdicts is just drag, which is exactly what you saw slowing runs down.

Have you tried keeping the history as "what changed and why" rather than the verdicts themselves — and did the runs get faster, or just quieter?

Collapse
 
jk576 profile image
James Kwok •

Thanks — you named the kill chain better than the article did. And your red-green example is almost word-for-word what happened to us: our first rule fired on three failing test runs in a row, which is exactly what honest debugging looks like. That misjudgment went into our changelog as a criterion change ("3 errors ≠ a loop"), not as a verdict log — mostly by discipline, though, not by mechanism.

Your question is the right measurement, and I want to be honest: we haven't run it. What we can say is that the misjudgment path wasn't just noisy — the recovery it fired (clear_recent_turns) wiped context mid-run, so wrong criteria carried real cost, not just false alarms. But "faster" as a measured outcome? Not yet.

Your "criterion change, not verdict log" is close to what our long-term memory layer already does across tasks — each new conclusion supersedes the old one with the reason attached. Wiring that into the run guard's failure history is still open. If you beat us to it, I genuinely want to see the numbers.

Collapse
 
alexshev profile image
Alex Shev •

Naming spin, blowup, thrash, drift, stall, and burn gives the operator more than a taxonomy: it creates a contract for what evidence each intervention needs. I would make every recovery produce a receipt with the triggering fingerprint, the chosen action, and the next progress signal expected. Then a later postmortem can tell whether the detector was wrong, the intervention was wrong, or the run simply never recovered.

Collapse
 
ethancole_ops profile image
Ethan Cole •

I like the distinction between a repeated identical call and changing debugging attempts; that keeps normal red-green work from being mislabeled as a loop. The separate stall watchdog also makes sense because a frozen event loop cannot diagnose itself. For teams adopting this, I'd start with the failure signal and safe stop behavior before adding automatic recovery—otherwise a mistaken detector can amplify the incident.

Collapse
 
jk576 profile image
James Kwok •

Agreed — and we have the scar tissue to prove it: pit 2 in the article is exactly your warning. A detector misfired on red tests, and the automatic recovery (clear_recent_turns) amplified the damage instead of containing it. A mistaken detector plus an active recovery is a force multiplier for the mistake.

One thing we'd add to your ordering: make the safe stop carry a human-readable message. Our stop verdict hands the user a plain-language "why we stopped and what we saw" — when the detector is wrong, that message is the fastest path to a human overruling it. So the ladder we'd recommend: detection → bounded, escalating recovery (never unbounded retries) → stop with an explanation, always available. Start with the signal and the stop, like you said; treat automatic recovery as the last thing you earn, not the first.

Collapse
 
the_daily_flare profile image
The daily flare •

The 4.5 hour freeze is the part I keep picturing in my own agents.

Collapse
 
jk576 profile image
James Kwok •

That's the one that scares me too — and it's exactly why the stall watchdog lives outside the event loop: a frozen loop can't diagnose itself. Our cheap signal is "process alive but heartbeat late = stall, not crash." If you ever catch one of your agents mid-freeze, I'd genuinely love to hear what the logs looked like.