Published
Read Time:
Detecting doom loops: what 582 spirals in production taught us about coding agents
Anyone who has run a coding agent for long enough has watched one lose the plot. It edits a file, the test fails, it edits the file again, the test fails again, and somewhere around the sixth attempt you realize it's rewriting the same ten lines back and forth like a Roomba stuck in a corner.
The interesting question isn't whether this happens. It's how often, to which models, and whether the layer that sees every request, the router, can catch it while it's happening.
The vantage point
The Weave router sits between agent harnesses and models, so it sees every turn of every session: the tool calls, the tool results, the errors, the files being touched. About a year ago we started running spiral detectors in shadow mode over that stream. They don't intervene; they just record when a session matches a known failure signature.
Two signatures do most of the work:
Same-file thrash. The agent edits one file over and over in a short window without the session making progress. Our detector fires around five or more edits to the same path.
Error streak. Three or more consecutive tool calls come back as errors and the agent keeps going anyway.
Over the last 30 days, across roughly 275,000 requests and 25,500 sessions, the detectors fired 582 times for spirals and 161 times for struggle (a broader "this session is having a bad time" signal). Call it low single-digit percentages of sessions. Rare enough that agents mostly work; common enough that at fleet scale, it's happening somewhere right now.
Nobody is immune
The distribution across models is the part worth publishing. Same-file thrash events in the period, by the model that was driving:
Model | Thrash events | Avg edits to same file |
|---|---|---|
claude-opus-5 | 94 | 5.7 |
claude-sonnet-5 | 68 | 6.5 |
minimax/minimax-m3 | 47 | 7.3 |
deepseek/deepseek-v4-pro | 44 | 6.1 |
gpt-5.5 | 26 | 5.5 |
claude-fable-5 | 22 | 6.6 |
moonshotai/kimi-k2.7 | 21 | 5.7 |
Yes, the frontier models are at the top of that table, partly because they handle the most traffic and the hardest work. The honest takeaway isn't "model X spirals more." It's that thrash shows up in every model we route, at every capability tier, with remarkably similar shape: five to seven edits to the same file before something breaks the loop. Spiraling looks less like a deficiency of any particular model and more like a failure mode of the agent loop itself. Give any model a stubborn test and a fast edit tool, and it can dig a hole.
Error streaks skew differently. deepseek-v4-flash led with 35 events at an average streak of 3.7 consecutive failed calls, which tracks: it handles enormous volumes of fast exploratory work where a wrong assumption about the environment fails repeatedly before the model adjusts.
The rarest failure has the best punchline
We also run a stricter detector for true loops: the agent issuing the byte-identical tool call with the byte-identical arguments, over and over. This is the pathological case, and it's genuinely rare. Single-digit events in the whole period. The two we caught were a GPT-5.5 session that repeated the same call ten times and a Kimi K3 session that managed eight.
When that detector fires with intervention enabled, the router breaks the loop by escalating the turn to a stronger model. Both escalations in the period went to Claude Opus 5, which looked at the same context and did something different on the first try. There's a satisfying pattern there: the cheapest fix for a stuck agent is often not a retry, a timeout, or a human. It's thirty seconds of a smarter model.
Meanwhile, the failure everyone worries about is basically solved
Here's the contrast that surprised us. Ask people what goes wrong with agent tool use and most will say malformed tool calls: bad JSON, missing arguments, hallucinated parameters. In our data that problem has quietly disappeared. Across more than 150,000 tool-use blocks in the period, the worst offender (qwen3.8-max) had an invalid-argument rate of 0.04%. Most models sat at a flat zero.
Models have gotten extremely good at the syntax of tool use. The failures that remain are semantic: calling the right tool, correctly, in service of a plan that stopped making sense three turns ago. You can't catch that with a JSON schema validator. You can catch it by watching behavior over time, which is exactly what a router, sitting in the request path with session-level memory, is positioned to do.
The syntax era of agent reliability is over. The behavioral era is just getting instrumented.
Published
Give your teams the data they need to build the products you want.
Trusted by engineering teams from startups to Fortune 500


