fix(doctor): honor providers.py ALIASES for local-server provider names#15778
fix(doctor): honor providers.py ALIASES for local-server provider names#15778cirwel wants to merge 1 commit into
Conversation
|
FYI — #16086 generalises along the same axis: it also unions |
Doctor's provider validation rejected `model.provider: "ollama"` (and
"lmstudio", "vllm", "llamacpp") with "is unknown" even though
`providers.py` ALIASES maps these to virtual canonicals ("custom",
"local") and the config docstring documents them as user-facing values
(`provider: "lmstudio"` is shown as the LM Studio example at lines
36-39 of `cli-config.yaml`).
Two-part fix:
1. `_resolve_provider_full(name)` returns None for virtual canonicals
like "custom" / "local" because `get_provider("custom")` is None
(custom is a sentinel, not a real provider definition). Fall back
to `normalize_provider(name)` so the alias map's canonical value
is honored.
2. Extend `known_providers` with `set(ALIASES.values())` so virtual
canonicals like "local" and "lmstudio" — which aren't in
PROVIDER_REGISTRY but are valid configuration values — pass the
membership check.
Adds parametrized test covering ollama / lmstudio / vllm / llamacpp.
1838658 to
27c9ffe
Compare
|
Thanks for the cross-link, @stevenchanin — agreed, the broader scope in #16086 makes sense if the maintainer wants to take it that direction. Happy for either approach to land first; the |
|
Closing in favor of #16086 to avoid duplicate maintainer triage. The local-provider alias behavior is covered there. Thanks for the cross-link. |
Summary
hermes doctorrejectsmodel.provider: "ollama"(and"lmstudio","vllm","llamacpp") with "is unknown" even thoughhermes_cli/providers.pyALIASES maps these to virtual canonicals ("custom","local") and the config template documents them as user-facing values:So
provider: "ollama"is the documented surface for "local Ollama via OpenAI-compatible endpoint" — but doctor surfaces it as a configuration error.Repro
(End user — me — hit this trying to point Hermes at a local Ollama for
qwen3.6:27b-coding-nvfp4. The agent ran fine; only doctor complained.)Root cause
Two separate gaps in
hermes_cli/doctor.py:_resolve_provider_full("ollama")returnsNone.normalize_provider("ollama")returns"custom"per ALIASES, butget_provider("custom")isNonebecause "custom" is a sentinel for "use whatever base_url is set" — not a real entry in models.dev / built-in registry. Soprovider_def is None→canonical_provider = None→ the membership check fails.known_providersis missing virtual canonicals like"local"and"lmstudio". Built fromPROVIDER_REGISTRY.keys() | {"openrouter", "custom", "auto"}, it excludes alias targets that aren't in the registry — so even if step 1 is fixed,vllm→localand barelmstudiowould still fail.Fix
Two-part, both in
hermes_cli/doctor.py:_resolve_provider_fullreturnsNone, fall back tonormalize_providerso the ALIASES table's canonical value is honored.known_providers |= set(ALIASES.values())so virtual canonicals are accepted.Net effect:
ollama→custom✓,lmstudio→lmstudio✓,vllm→local✓,llamacpp→local✓. Real typos (ollam,gpt, etc.) still fail becausenormalize_provideris the identity for unknown keys, and unknown keys aren't inknown_providers.Test
New parametrized test
test_run_doctor_accepts_local_provider_aliasescovering all four aliases. Modeled on existingtest_run_doctor_accepts_named_provider_from_providers_section(added inccc8fccf).Full
tests/hermes_cli/test_doctor.py— 26 tests, 0 failures, 14 prioraudioopdeprecation warnings (unrelated).Test plan
tests/hermes_cli/test_doctor.py— all pass (26 tests, 4 new)provider: "ollama"config now passeshermes doctoron local installNotes
provider: "ollama"already worked at runtime (ALIASES is consulted at every other call site). This only fixes the doctor's report.ALIASESis already exported as a module-level dict.providers.pyas a new helper).