-
Notifications
You must be signed in to change notification settings - Fork 4.1k
fix: autocompaction failures from exceeded context length #9567
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Learn moreAll Green is an AI agent that automatically: ✅ Addresses code review comments ✅ Fixes failing CI checks ✅ Resolves merge conflicts |
|
✅ Review Complete Code Review Summary |
sestinj
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
|
🎉 This PR is included in version 1.8.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |

Description
contextLength - maxTokens - Min(maxTokens, 15k). This is based off of reasoning that if we leave contextLength - maxTokens - output, we will always be able to compact the next turn, and data shows that max tokens > 15k is very rare. This doesn't account for tool output exceeding max tokens but the above change should reduce that issue quite a bit. It's difficult to deterministically prevent tool output from exceeding context length without complicated and/or partial pruning or super aggressive truncation but some complex pruning will likely be worth it in the near futureContinue Tasks:▶️ 2 queued — View all
Summary by cubic
Fixes auto-compaction failures by reserving space for the compaction prompt and centralizing compaction so we stay within the model’s context window. Also prevents context spikes from tool outputs with clear file-size errors and proportional limits when tools run in parallel, and adjusts token counting for non-GPT models.
Bug Fixes
Refactors
Written for commit c0a9309. Summary will update on new commits.