Repository navigation
Conversation
maxContextLimit/minContextLimit defaulted to 100000/50000 tokens: absolute numbers that only made sense for 128k windows. On models with larger windows the plugin compares the live token count against those fixed numbers, so a 1M-token model sitting at 250k tokens is reported as 250% of the limit. Every turn then injects "CRITICAL WARNING: MAX CONTEXT LIMIT REACHED" and pushes hard compression while three quarters of the window are still free. The percent form of both knobs already existed and is resolved against state.modelContextLimit, so only the default had to change: 70% / 35%. A 128k window resolves to ~90k / ~45k, keeping the behaviour the old numbers were written for, while large windows now scale instead of tripping early. When the model window is unknown the percent form resolves to undefined and the nudge fails open instead of nagging on a guessed budget. Schema, README and a regression test are updated to match. Per-model maxContextLimit/minContextLimit overrides, nudgeFrequency and iterationNudgeThreshold are untouched. Co-authored-by: Sinder <sinder@kss.local>
Author
|
Heads-up: CI sequence run locally Before opening I ran the npm ci --legacy-peer-deps # ok
npm run format:check # ok
npm run typecheck # ok
npm run build # ok
npm test # 123 pass
npm audit --audit-level=high # exit 1The last one fails with the current lock: 49 vulnerabilities — 13 high, 3 critical It is pre-existing. $ git diff master...HEAD -- package-lock.json package.json
# emptyso |
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 happens
maxContextLimit/minContextLimitdefault to absolute token counts(
100000/50000), while both already accept a percentage of the model window.On a 1M-token model at 250k tokens that is 2.5x the default maximum, so
isContextOverLimits()returnsoverMaxLimit: trueon every turn and DCP keepsinjecting:
…while three quarters of the window are still free.
Reproduced on OpenCode 2.2.5 with a 1M-window model at 250k tokens: the nudge
fires every turn.
Fix
Only the default changes.
resolveContextTokenLimit()already resolves"X%"against
state.modelContextLimit, so the plumbing stays untouched.lib/config.ts100000→"70%",50000→"35%"dcp.schema.jsoncompress.defaultblockREADME.mdtests/context-limit-defaults.test.tsA 128k window resolves to ~90k / ~45k, so small-window behaviour is preserved.
When the window is unknown the percentage resolves to
undefinedand the nudgefails open instead of nagging on a guessed budget.
Untouched:
nudgeFrequency,iterationNudgeThreshold,nudgeForce, and theper-model
modelMaxLimits/modelMinLimitsoverrides.Verification
overMaxLimit: false— wastrue, this is the bugtruefalse— fails opennpm test119 → 123 pass;typecheck,buildand prettier clean.The regression test asserts the shipped defaults against
dcp.schema.jsonand thelib/config.tssource rather than the runtime object, becauselib/configcannotbe imported under
tsx(itsjsonc-parsersubpath exposes no named exports).That is pre-existing and stated at the top of the test so the indirection does not
look accidental.