Degenerate token repetition in long sessions, only stoppable by user interrupt

Resolved 💬 2 comments Opened Jun 4, 2026 by Furinelle Closed Jul 9, 2026

What happened

In a long-running session (~$90+ spend, many turns), the model fell into a degenerate token-repetition loop three separate times, emitting one filler token (court) thousands of times until I manually interrupted. It could not self-recover.

Trigger pattern (consistent across all 3 occurrences)

  • Very long context window
  • Highly repetitive interaction structure: a PreToolUse hook (third-party ECC/GateGuard fact-force) forced a "state these facts → blocked → restate → retry" cycle that repeated 10+ times in-context
  • The collapse always started at the transition point right before / at a tool call

Expected vs actual

  • Expected: generation should not lock into single-token repetition; ideally a repetition / no-progress guard interrupts it
  • Actual: unbounded repetition until user interrupt

Steps to reproduce

  1. Enable a PreToolUse hook that blocks every Bash/Edit/Write and requires facts to be restated
  2. Run a long autonomous session (50+ tool calls) — this creates 10+ near-identical "restate → retry" blocks in context
  3. At some point during a tool-call transition, the model enters a degenerate loop emitting one token repeatedly

Notes

  • The repeated word (court) was semantically unrelated to the task (Python/trading) — consistent with an attractor-state filler token, not intended content
  • Different random seed would likely lock onto a different word
  • The model had no mechanism to detect or self-interrupt the loop; only user interrupt stopped it
  • Related ECC issue filed: https://github.com/affaan-m/ECC/issues/2142

Environment

Claude Code, macOS, claude-opus-4-8 model, ECC plugin 2.0.0-rc.1

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗