Repository navigation
fix(opencode): bound output reservation in compaction budget - #51712
Closed
naoufalelbani wants to merge 2 commits into
Closed
naoufalelbani wants to merge 2 commits into
naoufalelbani wants to merge 2 commits into
Conversation
3 tasks done
Contributor
|
The following comment was made by an LLM, it may be inaccurate: |
Member
|
This branch has been upgraded to V2. We're no longer taking PRs for V1. If you think this is still relevant, please port it over and open it for V2. — from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊 |
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.
Issue for this PR
Closes #51711
Type of change
What does this PR do?
usable()insrc/session/overflow.tssubtracted a model's full capped output limit fromthe context window instead of a bounded reservation, so a 1M model with a 512k output
capability got a 524,288 budget and compacted at 600k with ~500k of window still free.
The reservation is now bounded by the compaction buffer, limits are validated once in
normalizeLimits, and both call sites passflags.outputTokenMax. Malformed metadatadegrades to "unknown" rather than to a small default, so a 1M model is never mistaken for
a 16k one.
preserveRecentBudgetis unchanged.One semantic change worth a maintainer's call:
shouldCompactreturnsfalsewhen thebudget is
<= 0, so models with unknown limits skip predictive compaction and rely oncompactAfterOverflow. The old0 >= 0compacted on the first step of every turn. Happyto flip it or gate it behind config.
How did you verify your code works?
Covers 1M/128k/32k scaling, the 16.6k non-compaction case, malformed metadata (
0,negative,
NaN,Infinity,null, string),output > context,input > context,reasoning accounting, and retention asserted against the real
preserveRecentBudget.Screenshots / recordings
Not a UI change.
Checklist