-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fix: token counting issues in ChatAgent context management #3635
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
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
fengju0213
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.
Everything looks great, apart from the missing guard condition I mentioned.
I also have a suggestion regarding extensibility. Since we've completely removed the fallback mechanism in this PR, I wonder if we should consider retaining a limited fallback for cases where the context window is exceeded despite our proactive measures. Even if we trigger summarization at 50% context usage, there are edge cases where a single turn could still overwhelm the entire context window.
Previously, we handled this by providing a condensed summary of the tool call that caused the overflow, which gave the agent feedback to avoid repeating the same strategy. Since this logic has been removed, perhaps we could consider re-introducing a strategy (possibly in a future PR) to truncate tool outputs when a context explosion occurs, while still preserving a summary of the cause for the agent. What are your thoughts on this?
Co-authored-by: Tao Sun <[email protected]>
Co-authored-by: Tao Sun <[email protected]>
Description
Checklist
Go over all the following points, and put an
xin all the boxes that apply.Fixes #issue-numberin the PR description (required)pyproject.tomlanduv lockIf you are unsure about any of these, don't hesitate to ask. We are here to help!