[BUG] Conversation compaction captures rate limit message instead of actual 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?
When conversation context compaction triggers at the same time as hitting the rate limit, the compaction process captures the rate limit UI message ("You've hit your limit · resets 5am") instead of the actual conversation content. When returning after the rate limit resets, the conversation summary contains only the rate limit message, losing all prior context.
What Should Happen?
Compaction should only summarize actual conversation content, excluding system messages like rate limit notifications.
Error Messages/Logs
Steps to Reproduce
- Have a long conversation that approaches the context limit
- Continue chatting until you hit both the context limit (triggering compaction) AND the rate limit simultaneously
- Wait for the rate limit to reset and continue the conversation
- Observe that the conversation summary only contains the rate limit message, not any actual conversation context
(This is a condition that's difficult to reproduce on demand. It requires hitting both limits at nearly the same time)
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.0.75
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
Non-interactive/CI environment
Additional Information
<img width="690" height="263" alt="Image" src="https://github.com/user-attachments/assets/4dfcda46-f15f-4d54-a343-be8069760058" />
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗