Originally published as part of VerifyClaw's internal security research into LLM-facing attack surfaces — adapted here for a general audience.
Model-level looping is a single generation producing the same token sequence over and over, or continuing indefinitely without a useful stopping point. It's a narrower concern than an agent stuck in an external retry loop — this is about one model call losing its ability to terminate meaningfully, not an orchestration bug.
Why it matters for MCP agents
A stuck generation burns tokens, time, and — in an agent loop that feeds output back into the next step — can propagate the same degenerate content forward. Distinguishing this from a legitimately long, correct answer matters for both cost control and for not falsely flagging verbose-but-correct behavior as a failure.
How we study it
The useful signal is a repeated-suffix detector over the actual generated tokens, paired with the stop reason: did generation end because it hit an end-of-generation token, or because it ran into a hard token limit? A short repeated phrase that ends at a natural stop is a different finding than a long answer that gets cut off mid-thought by a limit. Neither on its own is a verdict — but conflating "limit reached" with "loop detected" (or vice versa) produces confident, wrong monitoring.
Related reading
Runaway generation loops are a reliability and cost problem as much as a security one — worth catching in testing before production.