Skip to content

The agent that grows with you

fix(models): external_process catalog fetch degrades to fallback_models on error; test mirrors registry via public types

teknium122beb95427ce
diff --git a/hermes_cli/models.py b/hermes_cli/models.py
index d03d15c6b98..3ea93debd2d 100644
--- a/hermes_cli/models.py
+++ b/hermes_cli/models.py
@@ -1511,7 +1511,11 @@ def _profile_live_catalog(normalized: str) -> Optional[list[str]]:
# Every non-api-key profile falls back to its own fallback_models (OAuth plugins have no
# static _PROVIDER_MODELS row), exactly as api_key plugins do below.
if profile.auth_type == "external_process":
- live = profile.fetch_models()
+ try:
+ live = profile.fetch_models()
+ except Exception as exc: # a failed subprocess launch degrades to the curated list, like api_key below
+ logger.debug("external_process catalog fetch failed for %s: %s", normalized, exc)
+ live = None
return list(live) if live else (list(profile.fallback_models) or None)
if not (profile.auth_type == "api_key" and profile.base_url):
return list(profile.fallback_models) or None
diff --git a/tests/hermes_cli/test_plugin_provider_picker_admission.py b/tests/hermes_cli/test_plugin_provider_picker_admission.py
index b482df29a71..abe5ab809de 100644
--- a/tests/hermes_cli/test_plugin_provider_picker_admission.py
+++ b/tests/hermes_cli/test_plugin_provider_picker_admission.py
@@ -19,8 +19,13 @@ def _register(monkeypatch, profile):
monkeypatch.setitem(providers._REGISTRY, profile.name, profile)
monkeypatch.delitem(auth.PROVIDER_REGISTRY, profile.name, raising=False)
- auth._register_plugin_provider(profile) # what plugin discovery does at import time
- monkeypatch.setitem(auth.PROVIDER_REGISTRY, profile.name, auth.PROVIDER_REGISTRY[profile.name])
+ # Mirror into the auth registry the way plugin discovery does; built from public types so the
+ # helper is independent of the auth module's private mirroring function.
+ pconfig = auth.ProviderConfig(
+ profile.name, profile.display_name or profile.name, profile.auth_type, inference_base_url=profile.base_url)
+ if profile.auth_type == "api_key" and profile.env_vars:
+ pconfig = auth._api_key_provider(profile.name, profile.display_name or profile.name, profile.base_url, tuple(profile.env_vars), "")
+ monkeypatch.setitem(auth.PROVIDER_REGISTRY, profile.name, pconfig)
@pytest.mark.parametrize("auth_type", ["external_process", "oauth_external", "oauth_device_code", "api_key"])