[BUG] Frequent premature compaction + infinite loop + prompt freezing with Opus 4.6 on 1M context
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Claude Code Version: 2.1.89
Model: claude-opus-4-6 (1M context)
OS: Debian 6.1.164-1
Platform: CLI
Bug Description:
Conversation is being compacted every 5–10 minutes despite context window never exceeding ~100K tokens. This has been ongoing for 1+ hour. The session is also unusually slow, and the prompt randomly freezes requiring Esc to unblock.
Expected Behavior:
Compaction should only trigger when approaching the context limit, not at <10% usage.
Actual Behavior:
- Compaction triggers every 5–10 minutes at low token usage (~100K / 1M)
- Session is significantly slower than normal
- Prompt occasionally freezes and requires Esc + Enter to recover
- Behavior consistent with the infinite compaction loop reported in #6004, #4878
Steps to Reproduce:
- Start Claude Code with
claude-opus-4-6on 1M context - Begin a multi-file coding session
- Observe repeated compaction at low token usage within minutes
What Should Happen?
Conversation compaction should only trigger when the context window is close to its limit (e.g., 90–95% of the 1M token budget). With a 1M context window and only ~100K tokens used, compaction should not occur at all. The session should remain responsive, and the prompt should never freeze or require manual interruption (Esc) to recover.
Error Messages/Logs
Steps to Reproduce
Steps to Reproduce:
- Start Claude Code with
claude-opus-4-6on 1M context - Begin a multi-file coding session
- Observe repeated compaction at low token usage within minutes
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.89
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
Windows Terminal
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗