Back to the ward
Case 0532MinorPerseveration

No Ceiling on How Long It Could Try

Admitted
2026-10-05
Source dataset
BugReAct (When Agents Fail)
Source
GitHub, loopgain-ai/loopgain
Failure mode
Infinite loop
Agent system
Autonomous loop
Tool access
Read-only
Industry
Software development

Presenting Behaviour

A static analysis of the AutoGen integration in an open-source agent project identified an unbounded loop pattern: the agent's execution logic ran as a while True: loop with no maximum step counter, no circuit breaker, and no fallback timeout. If an upstream agent stream failed to terminate cleanly (or if any condition within the loop failed to reach the expected exit state) worker threads would hang indefinitely. No mechanism existed to detect or interrupt the hang, and no maximum iteration count was configured to limit how long execution could continue before the agent was forced to exit or report.

Case Replay

A reconstruction, not a simulation. This sequence is reconstructed from the public incident record and summarised in our own words. It is a static record of what was reported, and nothing here can be run or replayed live.

4 steps

  1. Unbounded loop. Execution runs as a while True loop.
  2. Upstream stalls. A stream or condition fails to reach its exit. This is where the agent derailed.
  3. Threads hang. Workers wait indefinitely.
  4. No detection. Nothing interrupts or reports the hang.

Differential Diagnosis

An intentional design choice (the loop should always run until the task is done) considered. Some agent implementations intentionally run without a step cap, relying on internal task-completion signals. But an internal completion signal is only reliable if nothing in the environment can prevent it from arriving, which is exactly the assumption this pattern violates.

A theoretical concern without documented production impact, considered and partially granted. The issue was identified by static analysis; no specific incident was documented in the report. However, the pattern was explicitly identified in a commit to add a max_steps parameter and a timeout, indicating it was treated as a real risk by the maintainers.

Perseveration, most consistent with the concern: a loop with no exit cap is structurally committed to retrying until an external signal arrives, meaning any failure to deliver that signal produces unbounded repetition, the same structural property as every retry-storm failure, built in at the architecture level rather than emerging from a specific bad run.

Working Diagnosis

Perseveration: an unbounded loop with no maximum step count or timeout circuit breaker creates a structural commitment to indefinite repetition in the absence of a clean exit signal, regardless of how many iterations have already occurred.

Discussion

A loop that runs until done is only safe in an environment where 'done' is always reachable. In real agent deployments, clean termination signals are not guaranteed (APIs timeout, upstream agents stall, external services go quiet) and an unbounded loop is then an indefinitely running cost. The principled default is a configurable maximum iteration count that starts conservative and can be raised explicitly, never the reverse.

Mitigation Strategy

Set a configurable maximum iteration count that starts conservative and is raised explicitly.

Governance Guardrails

Maximum step counters; circuit breakers; fallback timeouts.

Typical Presentation in Human Patients

General clinical background, included for context. Not medical advice, and not a diagnosis of any individual.

Perseveration is the inappropriate repetition of a word, gesture, or action well past the point where it's still relevant or useful. It's a well-documented sign of frontal lobe dysfunction, and also appears in some forms of dementia and obsessive-compulsive disorder.

Source Note

GitHub, loopgain-ai/loopgain

https://github.com/loopgain-ai/loopgain/issues/22