Skip to content

fix(config): preserve list-format models in custom_providers normalize (#13509)#14495

Merged
teknium1 merged 2 commits into
mainfrom
hermes/hermes-6cf13b49
Apr 23, 2026
Merged

fix(config): preserve list-format models in custom_providers normalize (#13509)#14495
teknium1 merged 2 commits into
mainfrom
hermes/hermes-6cf13b49

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

custom_providers: entries with models: as a plain list now surface in the /model picker. Previously the normalize pass silently dropped list-format models, so configs using the hand-edited/legacy shape showed provider (0) in Telegram/Discord and the CLI even though the underlying picker logic handles lists fine.

Salvaged from #13509 by @drstrangerujn.

Root cause

_normalize_custom_provider_entry in hermes_cli/config.py only preserved models when it was a dict. Downstream the picker reads through get_compatible_custom_providers(cfg)list_authenticated_providers(), so a list-format models: was gone by the time the picker looked.

Changes

  • hermes_cli/config.py: list-format models: is converted to the empty-value dict shape ({model_id: {}}) the pipeline already expects. Dict entries pass through unchanged. Non-string / empty / whitespace entries are filtered out.
  • tests/hermes_cli/test_provider_config_validation.py: 4 new tests (list→dict conversion, dict passthrough, filter empties/non-strings, empty-list omission).
  • scripts/release.py: AUTHOR_MAP entry for @drstrangerujn.

Validation

E2E with the exact config from #13509:

custom_providers:
- name: tencent-coding-plan
  base_url: https://api.lkeap.cloud.tencent.com/coding/v3
  api_key: sk-...
  api_mode: chat_completions
  models:
  - glm-5
  - kimi-k2.5
  - minimax-m2.5
Before After
Picker row tencent-coding-plan (0) tencent-coding-plan (3)
Models surfaced [] [glm-5, kimi-k2.5, minimax-m2.5]

Targeted tests: tests/hermes_cli/test_provider_config_validation.py — 16/16 passing (12 existing + 4 new).

Also closes #11017 (duplicate report) and supersedes #12045 (different fix for the same bug, worse shape handling).

Closes #13509
Closes #11017

drstrangerujn and others added 2 commits April 23, 2026 02:30
_normalize_custom_provider_entry silently drops the models field when it's
a list. Hand-edited configs (and the shape used by older Hermes versions)
still write models as a plain list of ids, so after the normalize pass the
entry reaches list_authenticated_providers() with no models and /model
shows the provider with (0) models — even though the underlying picker
code handles lists fine.

Convert list-format models into the empty-value dict shape the rest of
the pipeline already expects. Dict-format entries keep passing through
unchanged.

Repro (before the fix):

    custom_providers:
    - name: acme
      base_url: https://api.example.com/v1
      models: [foo, bar, baz]

/model shows "acme (0)"; bypassing normalize in list_authenticated_providers
returns three models, confirming the drop happens in normalize.

Adds four unit tests covering list→dict conversion, dict pass-through,
filtering of empty/non-string entries, and the empty-list case.
@teknium1 teknium1 merged commit 33773ed into main Apr 23, 2026
10 of 11 checks passed
@teknium1 teknium1 deleted the hermes/hermes-6cf13b49 branch April 23, 2026 09:37
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/cli CLI entry point, hermes_cli/, setup wizard area/config Config system, migrations, profiles labels Apr 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/config Config system, migrations, profiles comp/cli CLI entry point, hermes_cli/, setup wizard P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: providers: dict models list silently dropped, causes duplicate entry with 0 models in /model picker

3 participants