fix(status): correct context percentage and sync consolidator#3209
Merged
fix(status): correct context percentage and sync consolidator#3209
Conversation
d39a1c3 to
e106349
Compare
…ator - Pass resolved self.context_window_tokens to Consolidator instead of raw parameter that could be None, preventing consolidation failures - Calculate percentage against input budget (ctx - max_completion - 1024) instead of raw context window, consistent with Consolidator/snip formulas - Pass actual max_completion_tokens from provider to build_status_content - Cap percentage display at 999 to prevent runaway values - Add tests for budget-based percentage and cap behavior
e106349 to
f33cc38
Compare
Collaborator
Author
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.
Summary
/statuscontext percentage exceeding 100% and inaccurate countingself.context_window_tokensto Consolidator instead of raw parameter (could beNone)ctx - max_completion - 1024) instead of raw context window, consistent with Consolidator/snip budget formulasChanges
loop.py: Passself.context_window_tokens(resolved) to Consolidator instead of raw parameterhelpers.py: Use input budget as percentage denominator (ctx_total - max_completion_tokens - 1024), cap at 999, add "of input budget" labelbuiltin.py: Pass actualmax_completion_tokensfrom provider tobuild_status_contenttest_build_status.py: Add 2 tests for budget-based percentage and 999 capDisplay
Before:
After:
The fraction uses the total context window; the percentage uses the input budget (total minus completion reserve and safety buffer), aligned with how Consolidator and
_snip_historycalculate budgets.Test plan
tests/test_build_status.py— 6 passed (2 new)