Skip to content

fix(model_switch): prevent bare 'custom' slug in model.provider (#17478)#17891

Merged
teknium1 merged 3 commits into
mainfrom
fix/17478-custom-provider-slug
Apr 30, 2026
Merged

fix(model_switch): prevent bare 'custom' slug in model.provider (#17478)#17891
teknium1 merged 3 commits into
mainfrom
fix/17478-custom-provider-slug

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Salvages #17481 by @Andy283 onto current main. Closes #17478.

Problem

After a prior failed /model switch leaves the bare literal "custom" in model.provider, the picker perpetuates the broken state on every subsequent invocation (endpoint matches → slug propagates as "custom"). Every agent session then fails with Unknown provider 'custom'.

Fix (author: @Andy283, 2 files, +33/-1)

  • hermes_cli/model_switch.py — slug assignment guards against bare "custom"; falls back to canonical custom:<name> form via custom_provider_slug(display_name).
  • hermes_cli/providers.pyresolve_custom_provider() self-heals when requested == "custom" by returning the first valid custom_providers entry, so existing corrupted configs recover instead of hard-failing.

Follow-up commits on top of the salvage

  • chore(release): map 16577466+andy825@user.noreply.gitee.comAndy283 in AUTHOR_MAP (otherwise the contributor-check CI job fails).
  • test(model_switch): update the existing test_list_authenticated_providers_current_endpoint_uses_current_slug test (it was asserting the bug behavior — slug equals "custom" when that's what was passed in). New assertion reflects the fix; a companion regression test test_list_authenticated_providers_bare_custom_slug_recovers pins the recovery path for bug: picker writes literal 'custom' to model.provider instead of actual provider name #17478.

Validation

scripts/run_tests.sh tests/hermes_cli/test_model_switch_custom_providers.py \
                     tests/hermes_cli/test_custom_provider_model_switch.py \
                     tests/hermes_cli/test_user_providers_model_switch.py
50 passed in 2.10s

Authorship preserved via plain cherry-pick for @Andy283's original fix commit.

Andy and others added 3 commits April 30, 2026 03:09
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
@alt-glitch alt-glitch added type/bug Something isn't working P1 High — major feature broken, no workaround comp/cli CLI entry point, hermes_cli/, setup wizard labels Apr 30, 2026
@teknium1 teknium1 merged commit 3fc4c63 into main Apr 30, 2026
12 checks passed
@teknium1 teknium1 deleted the fix/17478-custom-provider-slug branch April 30, 2026 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard P1 High — major feature broken, no workaround type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: picker writes literal 'custom' to model.provider instead of actual provider name

2 participants