fix(model): warn on stale context_length after /model --global - #10366
fix(model): warn on stale context_length after /model --global#10366LeonSGP43 wants to merge 1 commit into
Conversation
teknium1
left a comment
There was a problem hiding this comment.
Thanks for preserving the explicit override rather than silently rewriting it. The stale-override premise still exists on current main: cli.py:7946-7949 persists only the model/provider, and the gateway persists the same fields at gateway/slash_commands.py:1916-1923.
Problems
hermes_cli/model_switch.py:133usesModelInfo.context_windowbefore provider-aware resolution. Currentresolve_display_context_length()explicitly treatsget_model_context_length()as authoritative for provider caps (hermes_cli/model_switch.py:689-715), so this can recommend the vendor-wide context instead of the effective one. The helper also cannot receivecustom_providers.hermes_cli/model_switch.py:155recommends/context <n>, but current main has no/contextcommand definition or handler.- The gateway handler has moved to
gateway/slash_commands.py:1399; the current TUI persistence path attui_gateway/server.py:2795-2812also needs equivalent handling if this is to cover Hermes' /model surfaces.
Suggested changes
- Rework the helper around the provider-aware resolver with
config_context_length=None, and pass compatible custom-provider data. - Point users to an existing configuration workflow, or implement
/contextas a separate command. - Cover provider-capped and custom-provider context values in regression tests.
Automated hermes-sweeper review.
| return "" | ||
|
|
||
| target_ctx = 0 | ||
| if result.model_info and isinstance(result.model_info.context_window, int): |
There was a problem hiding this comment.
ModelInfo.context_window can be the vendor-wide catalog value rather than this provider's effective cap. Resolve through the same provider-aware path as current resolve_display_context_length() (and include custom-provider overrides) before composing a recommended replacement.
|
|
||
| return ( | ||
| f"config.yaml context_length ({config_ctx:,}) doesn't match this model. " | ||
| f"Run /context {target_ctx} to update, or keep the current value if intentional." |
There was a problem hiding this comment.
/context is not a registered Hermes slash command on current main, so this remediation cannot be followed. Please point to an existing supported config workflow or add the command separately.
Summary
/model --globalleaves an existingmodel.context_lengthoverride out of sync with the newly selected model/context <n>when they do want to update it/modelcommand, with focused regression coverageFixes #10157
Testing