fix: prevent bare 'custom' slug in model.provider (#17478)#17481
Closed
Andy283 wants to merge 1 commit into
Closed
fix: prevent bare 'custom' slug in model.provider (#17478)#17481Andy283 wants to merge 1 commit into
Andy283 wants to merge 1 commit into
Conversation
When hermes model picker switches to a custom_providers entry, the slug assignment can write the literal string 'custom' to model.provider if a prior failed switch already left that value in config.yaml. Two fixes: 1. model_switch.py: filter out bare 'custom' in slug assignment, always resolve to canonical custom:<name> form 2. providers.py: resolve_custom_provider() self-heals bare 'custom' by falling back to the first valid custom_providers entry Closes NousResearch#17478
13 tasks
6 tasks
Contributor
|
Salvaged onto current |
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
hermes modelinteractive picker to switch to acustom_providersentry, the CLI can write the literal stringcustomtomodel.providerin config.yaml instead of the actual provider name (e.g.xiaomi-coding).This causes every subsequent session to fail with:
Root cause: in
list_authenticated_providers()(model_switch.py:1466-1472), whencurrent_provideris already"custom"from a prior failed switch andcurrent_base_urlmatches, slug gets set to the literal"custom". Thenresolve_provider_full("custom")finds no match since the canonical slug iscustom:xiaomi-coding.Fix (2 files, +33/-1)
hermes_cli/model_switch.py — Slug assignment guards against bare
"custom":current_provideris"custom", fall back tocustom_provider_slug(display_name)which produces the canonicalcustom:<name>formhermes_cli/providers.py — Self-healing fallback in
resolve_custom_provider():requested == "custom"matches nothing by name or slug, fall back to the first validcustom_providersentry so corrupted configs auto-recoverTesting
9/9 test cases pass:
"custom"self-heals to first entryCloses #17478