Agent burns tokens endlessly - gets stuck in unbounded thinking loops

Resolved 💬 3 comments Opened Feb 16, 2026 by mannewalis Closed Feb 20, 2026

Description

The agent periodically gets stuck in unbounded thinking loops, burning tokens indefinitely without producing any useful output or tool calls. The user must manually press Escape to stop it. This wastes significant token budget and blocks productive work.

Example: Post-compaction stuck loop

After conversation compaction, the agent restored context normally (re-read several project files, restored skills) but then entered an endless thinking state:

✻ Conversation compacted (ctrl+o for history)
  ⎿  Read [several project files restored normally]
  ⎿  Skills restored

✳ Thinking… (21m 12s · ↓ 72.9k tokens · thinking)

21 minutes, 72.9k tokens consumed, zero output. Had to Escape to stop it.

Not limited to compaction

This is not exclusively a post-compaction issue. The agent gets stuck in these unbounded thinking loops at other times too — the token count just climbs and nothing happens until the user manually interrupts.

Impact

  • Burns significant token budget with no productive output
  • Blocks work for extended periods (observed 20+ minutes)
  • Requires manual Escape to recover
  • No way to prevent or detect it proactively
  • Previously reported months ago with no response

Expected Behavior

The agent should have a reasonable upper bound on thinking time before either producing output, making a tool call, or surfacing that it's stuck.

Environment

  • Model: claude-opus-4-6
  • Platform: macOS
  • CLI: Claude Code

View original on GitHub ↗

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