fix: sync model.context_length on --global model switch - #17245
Closed
solink7 wants to merge 1 commit into
Closed
Conversation
When using /model <name> --global, the resolved context length was displayed but not persisted to config.yaml. This caused a mismatch: the new model's context window was shown correctly in the switch confirmation, but compression thresholds and token budgets continued using the old model's context_length from config. Now model.context_length is saved alongside model.default and model.provider when --global is specified.
Collaborator
Author
|
Superseded by #17246 which includes both the config persistence fix and runtime display update. |
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.
Problem
When using
/model <name> --global, the resolved context length was displayed correctly in the switch confirmation but not persisted toconfig.yaml. This caused:model.context_lengthstayed at the old model valueRoot Cause
In
_apply_model_switch_result(), the context length was resolved viaresolve_display_context_length()for display, but thepersist_globalblock only savedmodel.defaultandmodel.provider— it never savedmodel.context_length.Fix
ctxvariable to outer scope so it is available after the try/except blockpersist_globalis true andctxis resolved, save it withsave_config_value("model.context_length", ctx)Testing