[Fix] Context truncation shows inflated token counts after earlier condenses#234
Open
roomote[bot] wants to merge 3 commits into
Open
[Fix] Context truncation shows inflated token counts after earlier condenses#234roomote[bot] wants to merge 3 commits into
roomote[bot] wants to merge 3 commits into
Conversation
Contributor
Author
|
No code issues outstanding; 1 check still pending. See task
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Contributor
|
@roomote can you review |
Contributor
Author
|
I started a PR review task for this request. See task |
Contributor
Author
|
Addressed the latest follow-up review comment in 0755fa5. Fallback truncation now derives its candidate indices from the same effective-history filtering used for provider requests, including fresh-start cleanup of orphan Validation:
The code review item is fixed; GitHub checks are still running. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What problem this solves
Fixes an issue where the
Context truncatedmessage could show a larger token count after truncation than before when a task had already condensed earlier history.Why this change was made
The post-truncation logic was mixing two histories: the recount used the effective API history, but the fallback truncation selector was still using a separate visibility pass that could drift from the real provider history. This switches truncation to derive its candidate indices from the same effective-history filtering, including fresh-start cleanup of orphan
tool_result-only messages, and adds focused regressions for both the selector and the recount.User impact
The truncation UI now reports the remaining context count instead of inflating it with hidden historical messages, so long-running tasks show accurate context-management feedback.