fix(config): preserve list-format models in custom_providers normalize (#13509)#14495
Merged
Conversation
_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.
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.
Summary
custom_providers:entries withmodels:as a plain list now surface in the/modelpicker. Previously the normalize pass silently dropped list-formatmodels, so configs using the hand-edited/legacy shape showedprovider (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_entryinhermes_cli/config.pyonly preservedmodelswhen it was adict. Downstream the picker reads throughget_compatible_custom_providers(cfg)→list_authenticated_providers(), so a list-formatmodels:was gone by the time the picker looked.Changes
hermes_cli/config.py: list-formatmodels: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:
tencent-coding-plan (0)tencent-coding-plan (3)[][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