[BUG] Reasoning loop on repeated Read of same file offset — Claude Code v2.1.220 stops making progress after compaction
Summary
Claude Code v2.1.220 enters a reasoning deadlock: after context compaction, it repeatedly reads the same file at the same offset without making any code changes or tool calls beyond Read. The session becomes unresponsive to user input — every "continue" prompt triggers another identical Read, creating an infinite loop with zero progress.
Environment
- Claude Code: v2.1.220 (also observed in v2.1.219–v2.1.224 range per #84738)
- Platform: macOS 26.5.1 (darwin)
- Model: glm-5.2 (via ANTHROPIC_BASE_URL proxy)
- Session type: tmux window, long-running work session
Reproduction
- Start a Claude Code session doing code refactoring (Go project, upload.go CheckRedirect fix)
- Complete multiple Read + Edit operations on the same file
- Context approaches compact threshold → /compact fires
- After compaction, Claude attempts to continue the refactoring task
- Claude enters a loop: Read upload.go offset=95 → Read upload.go offset=95 → Read upload.go offset=95 ...
- Each "continue" user prompt triggers another Read of the same offset
- No Edit, Write, or any tool call beyond Read is ever issued again
Observed Behavior
tmux capture shows the following pattern repeating 5+ times with no variation:
❯ 继续
Thought for 7s
⏺ Read(upload.go, offset=95)
❯ 继续
Thought for 8s
⏺ Read(upload.go, offset=95)
❯ 继续
Thought for 8s
⏺ Read(upload.go, offset=95)
❯ ?你这是怎么了,怎么不往下走
Thought for 3s
⏺ Read(upload.go, offset=95)
The session process is alive (pid=45593, dead=0) but produces no actionable output. The model appears stuck in a "understand the file" reasoning loop and never transitions to "edit the file".
Expected Behavior
After compaction, Claude should either:
- Complete the pending code change (Edit/Write upload.go)
- Ask the user a clarifying question
- Or at minimum vary its approach after the same Read yields no new insight
Related Issues
- #84738: Advisor turns double-count context usage (same version range, suggests broader context management issues)
- #86198: Slash command during advisor in-flight corrupts session (session state management fragility)
Workaround
Ctrl+C to interrupt the loop, then /clear to reset context. Re-issue the task with a more focused prompt. The bug may be related to post-compaction context reconstruction — reducing context pressure before compaction may help.
Severity
🔴 Fatal — the session becomes completely unusable after compaction. The only recovery is /clear (discarding all context), losing all prior work context. No graceful degradation path.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗