Skip to content

The agent that grows with you

fix(auth): recognise a bare named providers: pin in boot inventory

Everson Menezes Santos907bf871d2e0
diff --git a/hermes_cli/auth.py b/hermes_cli/auth.py
index 755523ccec9..6209860a28c 100644
--- a/hermes_cli/auth.py
+++ b/hermes_cli/auth.py
@@ -1329,6 +1329,17 @@ def _config_model_provider() -> Tuple[Any, Optional[str]]:
return model_cfg, "openrouter"
if provider in PROVIDER_REGISTRY:
return model_cfg, provider
+ # A bare name matching an enabled ``providers:`` / ``custom_providers:`` entry is the same
+ # explicit intent, spelled by name instead of by the ``custom:<name>`` form. The runtime
+ # resolver already routes it (``hermes chat`` works), so without this rung the two paths
+ # disagree and the dashboard parks on Setup Required for a working config — the #109397
+ # symptom, one rung over. has_named_custom_provider() is the runtime's own lookup: it
+ # ignores disabled entries and entries without a usable endpoint, and covers both the
+ # current ``providers:`` and the legacy ``custom_providers:`` spellings.
+ if provider:
+ from hermes_cli.runtime_provider_custom import has_named_custom_provider
+ if has_named_custom_provider(provider):
+ return model_cfg, "custom"
# No provider pin but a base_url the bare-custom runtime rung would honour (a loopback
# llama.cpp/vLLM/ollama server) — same explicit intent, spelled by URL.
if base_url:
diff --git a/tests/hermes_cli/test_resolve_provider_custom_endpoint.py b/tests/hermes_cli/test_resolve_provider_custom_endpoint.py
index afbb3896d82..3fbe709c64d 100644
--- a/tests/hermes_cli/test_resolve_provider_custom_endpoint.py
+++ b/tests/hermes_cli/test_resolve_provider_custom_endpoint.py
@@ -87,6 +87,28 @@ def test_configured_openrouter_pin_resolves_as_a_provider(isolated_home):
assert record.inference_provider == "openrouter"
+def test_named_provider_pin_resolves_as_a_provider(isolated_home):
+ """A bare ``model.provider`` naming a ``providers:`` entry is explicit intent too.
+
+ Sibling of the openrouter rung above: ``has_named_custom_provider()`` already routes this
+ config at runtime (``hermes chat`` works against ``providers.CPA``), but the boot inventory
+ discarded the bare name, so ``setup.status`` reported ``provider_configured: False`` and the
+ dashboard parked sessions on Setup Required for a working endpoint.
+ """
+ (isolated_home / "config.yaml").write_text(
+ "model:\n default: test-model\n provider: CPA\n\n"
+ "providers:\n CPA:\n api: http://127.0.0.1:8317/v1\n default_model: test-model\n",
+ encoding="utf-8",
+ )
+ from hermes_cli.auth import resolve_provider
+ from hermes_cli.free_tier_bootstrap import run_bootstrap
+
+ assert resolve_provider("auto") == "custom"
+ record = run_bootstrap(announce=False)
+ assert record.provider_configured is True
+ assert record.other_providers is True
+
+
def test_stale_remote_base_url_without_a_custom_pin_is_not_a_provider(isolated_home):
"""The URL rung follows the runtime's own trust rule: a non-loopback ``base_url`` left behind
under a bare (unpinned) provider is not custom intent (#14676), so a blank machine still reads