fix(model_switch): prevent bare 'custom' slug in model.provider (#17478)#17891
Merged
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 #17478
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.
Salvages #17481 by @Andy283 onto current
main. Closes #17478.Problem
After a prior failed
/modelswitch leaves the bare literal"custom"inmodel.provider, the picker perpetuates the broken state on every subsequent invocation (endpoint matches → slug propagates as"custom"). Every agent session then fails withUnknown provider 'custom'.Fix (author: @Andy283, 2 files, +33/-1)
"custom"; falls back to canonicalcustom:<name>form viacustom_provider_slug(display_name).resolve_custom_provider()self-heals whenrequested == "custom"by returning the first validcustom_providersentry, so existing corrupted configs recover instead of hard-failing.Follow-up commits on top of the salvage
chore(release): map16577466+andy825@user.noreply.gitee.com→Andy283in AUTHOR_MAP (otherwise the contributor-check CI job fails).test(model_switch): update the existingtest_list_authenticated_providers_current_endpoint_uses_current_slugtest (it was asserting the bug behavior — slug equals"custom"when that's what was passed in). New assertion reflects the fix; a companion regression testtest_list_authenticated_providers_bare_custom_slug_recoverspins the recovery path for bug: picker writes literal 'custom' to model.provider instead of actual provider name #17478.Validation
Authorship preserved via plain cherry-pick for @Andy283's original fix commit.