Skip to content

The agent that grows with you

fix(models): admit plugin external_process providers into the picker

tobenwarrior3c5d4b0578f8
diff --git a/hermes_cli/models_catalog_static.py b/hermes_cli/models_catalog_static.py
index f74f4878196..03bc8473e85 100644
--- a/hermes_cli/models_catalog_static.py
+++ b/hermes_cli/models_catalog_static.py
@@ -347,14 +347,24 @@ CANONICAL_PROVIDERS: list[ProviderEntry] = [ProviderEntry(*row) for row in (
# Auto-extend CANONICAL_PROVIDERS with providers registered under plugins/model-providers/<name>/
# so a new provider reaches the picker, /model and every downstream consumer without edits here.
-# Non-api-key flows need bespoke picker UX and are skipped.
+# Auth classes whose picker selection needs bespoke UX (OAuth device flows, vendor CLIs) are
+# skipped; external_process providers are admitted because their picker row is honest —
+# `_provider_has_credentials` routes through auth.get_external_process_provider_status, which
+# reports configured only when the subprocess binary resolves, and selection rides the standard
+# model_switch pipeline.
_canonical_slugs = {p.slug for p in CANONICAL_PROVIDERS}
+_BESPOKE_UX_AUTH_TYPES = {"oauth_device_code", "oauth_external", "aws_sdk", "copilot", "vertex"}
+
+
+def _plugin_provider_enters_picker(pp) -> bool:
+ """Picker admission for a plugin model-provider profile."""
+ return pp.name not in _canonical_slugs and pp.auth_type not in _BESPOKE_UX_AUTH_TYPES
+
+
try:
from providers import list_providers as _list_providers_for_canonical
for _pp in _list_providers_for_canonical():
- if _pp.name in _canonical_slugs or _pp.auth_type in {
- "oauth_device_code", "oauth_external", "external_process", "aws_sdk", "copilot", "vertex",
- }:
+ if not _plugin_provider_enters_picker(_pp):
continue
_label = _pp.display_name or _pp.name
CANONICAL_PROVIDERS.append(ProviderEntry(_pp.name, _label, _pp.description or f"{_label} (direct API)"))
diff --git a/tests/hermes_cli/test_plugin_acp_picker_parity.py b/tests/hermes_cli/test_plugin_acp_picker_parity.py
new file mode 100644
index 00000000000..72407926112
--- /dev/null
+++ b/tests/hermes_cli/test_plugin_acp_picker_parity.py
@@ -0,0 +1,58 @@
+"""Picker parity for plugin external-process (ACP) providers.
+
+Regression: the CANONICAL_PROVIDERS auto-extend skipped every plugin
+`auth_type="external_process"` provider, so plugin ACP backends never reached
+`/model` / `list_available_providers()` — while the in-tree copilot-acp
+provider (same auth_type, hardcoded list entry) does appear. Selection already
+works through the standard model_switch pipeline, and the authenticated flag
+comes from auth.get_external_process_provider_status; only picker admission
+was missing.
+"""
+
+from types import SimpleNamespace
+
+import pytest
+
+
+def _profile(name: str, auth_type: str) -> SimpleNamespace:
+ return SimpleNamespace(
+ name=name, auth_type=auth_type, display_name=name.title(),
+ description=f"{name} test provider", aliases=(),
+ )
+
+
+def test_external_process_plugin_provider_admitted():
+ from hermes_cli.models_catalog_static import _plugin_provider_enters_picker
+
+ assert _plugin_provider_enters_picker(_profile("acme-acp", "external_process")) is True
+
+
[email protected]("auth_type", ["oauth_device_code", "oauth_external", "aws_sdk", "copilot", "vertex"])
+def test_bespoke_auth_classes_still_excluded(auth_type):
+ from hermes_cli.models_catalog_static import _plugin_provider_enters_picker
+
+ assert _plugin_provider_enters_picker(_profile("acme-" + auth_type.replace("_", ""), auth_type)) is False
+
+
+def test_api_key_plugin_providers_unchanged():
+ from hermes_cli.models_catalog_static import _plugin_provider_enters_picker
+
+ assert _plugin_provider_enters_picker(_profile("acme-api", "api_key")) is True
+
+
+def test_auto_extend_seats_external_process_provider(monkeypatch):
+ """Integration through the real auto-extend loop (reloaded with a stubbed
+ plugin registry, mirroring discovery output)."""
+ import importlib
+ import providers
+ import hermes_cli.models_catalog_static as mcs
+
+ fake = [_profile("acme-acp", "external_process"), _profile("acme-oauth", "oauth_external")]
+ monkeypatch.setattr(providers, "list_providers", lambda: fake)
+ reloaded = importlib.reload(mcs)
+ try:
+ ids = [p.slug for p in reloaded.CANONICAL_PROVIDERS]
+ assert "acme-acp" in ids
+ assert "acme-oauth" not in ids
+ finally:
+ importlib.reload(mcs) # restore the real module state