Apply provider context window settings to occupancy lookups - #923
Merged
TheGreatAxios merged 1 commit intoSep 12, 2026
Merged
TheGreatAxios merged 1 commit into
TheGreatAxios merged 1 commit into
Conversation
The settings field was parsed but occupancy and compaction still used models.dev metadata and family heuristics. An override at config load is the one place that can beat both without being wiped by a later pricing refresh.
TheGreatAxios
commented
Sep 12, 2026
TheGreatAxios
left a comment
Collaborator
Author
There was a problem hiding this comment.
Critic · Comment
Wires providers.<name>.contextWindow into contextWindowFor at loadConfig after resolveProvider. Overrides beat registry/heuristic; OAuth projection still drops the field.
Findings
src/provider/context-window.ts:111— override lookup reuses registrylookupCandidates, so a prefixed id for a provider that did not setcontextWindowstill hits the resolved provider's bare key. Sequence: firepass{models:["fp-large"], contextWindow:32000}+ other{models:["fp-large"]}(no window), resolve firepass;contextWindowFor("other:fp-large")andhasContextWindowFor("other:fp-large")return 32k / true via candidatefp-large. Occupancy uses baresource.model/config.model, so the meter still honors the startup provider; the model-catalogprovider:modelpath does not. Production already writes<provider>:<model>for every overridden provider — exact override match would keep the bare-key rule without this bleed. The unit test atcontext-window.test.ts:45encodes the fallthrough by setting only a bare map.
Notes
- OAuth gap is documented, not silently copied (
providersAsSettingsomits the field;settingsForResolutionoverwrites). Leave it. - Bare keys stay frozen at the loadConfig-resolved provider. After
/agentswitch, compaction (lastModel = event.source?.model) and the status-bar meter (state.config.model) miss the other provider's override;maxTokensForstill reads live settings. Matches the stated keying; not a merge blocker.
TheGreatAxios
deleted the
cl-7762-providersnamecontextwindow-is-parsed-but-never-applied-wire
branch
September 12, 2026 03:16
Merged
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
providers.<name>.contextWindowat config load so occupancy, compaction, and the status-bar meter honor the setting<provider>:<model>for every model on a provider that sets the field, plus the bare model id for the resolved providerVerification
bun run typecheck,bun run build, andbun run testpassbun run checkpasses (6957 pass, 0 fail)Fixes CL-7762