The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(agent): key ACP launch kwargs on provider profile, not vendor slug
tobenwarriorcc2ec588f21c
diff --git a/agent/agent_init.py b/agent/agent_init.pyindex 8b8962db8bf..a038cc2971f 100644--- a/agent/agent_init.py+++ b/agent/agent_init.py@@ -792,9 +792,18 @@ def _explicit_client_kwargs(agent, api_key, base_url, _provider_timeout) -> Dictclient_kwargs["default_query"] = {k: v[0] for k, v in parse_qs(_parsed_url.query).items()}if _provider_timeout is not None:client_kwargs["timeout"] = _provider_timeout- if agent.provider == "copilot-acp":- client_kwargs["command"] = agent.acp_command- client_kwargs["args"] = agent.acp_args+ # ACP/subprocess providers take launch kwargs instead of HTTP credentials. Keyed on the+ # provider profile's auth_type, not one vendor slug, so out-of-tree external_process+ # plugin providers get the same launch path as the built-in copilot-acp (#102421).+ try:+ from providers import get_provider_profile++ profile = get_provider_profile(agent.provider)+ if profile is not None and profile.auth_type == "external_process":+ client_kwargs["command"] = agent.acp_command+ client_kwargs["args"] = agent.acp_args+ except Exception as exc:+ logger.debug("External-process launch kwargs unavailable for %s: %s", agent.provider, exc)_headers_for = _host_default_headers_factory(base_url)if _headers_for is not None:client_kwargs["default_headers"] = _headers_for(api_key, base_url)diff --git a/hermes_cli/models.py b/hermes_cli/models.pyindex 9f419f47887..fb0a026b0f3 100644--- a/hermes_cli/models.py+++ b/hermes_cli/models.py@@ -1507,7 +1507,15 @@ def _profile_live_catalog(normalized: str) -> Optional[list[str]]:# external_process providers (ACP agent CLIs) have no api_key/base_url credentials:# the profile's fetch_models drives its own subprocess, so let it supply the catalog.if profile and profile.auth_type == "external_process":- live = profile.fetch_models()+ # Signature tolerance: external_process profiles own their subprocess and most take no+ # kwargs, but a profile may require keyword-only HTTP credentials (#111194 hardened+ # discovery the same way). Probe no-args first, fall back to credential kwargs.+ try:+ live = profile.fetch_models()+ except TypeError:+ api_key, base_url = _api_key_credentials(normalized)+ live = profile.fetch_models(+ api_key=api_key, base_url=base_url or profile.base_url or None)return list(live) if live else Noneif not (profile and profile.auth_type == "api_key" and profile.base_url):return Nonediff --git a/tests/hermes_cli/test_plugin_acp_picker_parity.py b/tests/hermes_cli/test_plugin_acp_picker_parity.pyindex 33c85057e2c..95fbdc0c4c7 100644--- a/tests/hermes_cli/test_plugin_acp_picker_parity.py+++ b/tests/hermes_cli/test_plugin_acp_picker_parity.py@@ -27,6 +27,41 @@ def test_external_process_plugin_provider_admitted():assert _plugin_provider_enters_picker(_profile("acme-acp", "external_process")) is True+def test_explicit_client_kwargs_launches_any_external_process_profile(monkeypatch):+ """Launch kwargs are keyed on the provider profile's auth_type, not a hardcoded+ vendor slug: an out-of-tree external_process provider gets the same ACP launch+ path (command/args) as copilot-acp (#102421)."""+ import providers as providers_mod+ from agent.agent_init import _explicit_client_kwargs++ class _Agent:+ provider = "acme-acp"+ acp_command = ["acme"]+ acp_args = ["--stdio"]++ monkeypatch.setattr(providers_mod, "get_provider_profile",+ lambda name: SimpleNamespace(auth_type="external_process"))+ kwargs = _explicit_client_kwargs(_Agent(), api_key=None, base_url=None, _provider_timeout=None)+ assert kwargs["command"] == ["acme"] and kwargs["args"] == ["--stdio"]+++def test_explicit_client_kwargs_copilot_acp_still_launches(monkeypatch):+ """The built-in copilot-acp provider keeps its launch kwargs through the generic+ profile-keyed path — same contract, now without the vendor hardcode."""+ import providers as providers_mod+ from agent.agent_init import _explicit_client_kwargs++ class _Agent:+ provider = "copilot-acp"+ acp_command = ["copilot"]+ acp_args = []++ monkeypatch.setattr(providers_mod, "get_provider_profile",+ lambda name: SimpleNamespace(auth_type="external_process"))+ kwargs = _explicit_client_kwargs(_Agent(), api_key=None, base_url=None, _provider_timeout=None)+ assert kwargs["command"] == ["copilot"]++@pytest.mark.parametrize("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@@ -40,6 +75,34 @@ def test_api_key_plugin_providers_unchanged():assert _plugin_provider_enters_picker(_profile("acme-api", "api_key")) is True+def test_live_catalog_tolerates_credential_kwargs_fetch_models():+ """A signature-strict external_process profile (fetch_models requiring keyword-only+ api_key/base_url) still yields its catalog: probe no-args, fall back to credentials+ (#111194 hardened discovery the same way)."""+ from hermes_cli.models import _profile_live_catalog++ def _strict_fetch(*, api_key, base_url):+ assert api_key, "credential kwargs must be passed on the TypeError fallback"+ return ["acme-pro"]++ profile = SimpleNamespace(+ auth_type="external_process", fetch_models=_strict_fetch,+ base_url="https://acme.example/v1",+ )+ import providers as providers_mod+ import hermes_cli.models as models_mod+ orig = getattr(providers_mod, "get_provider_profile", None)+ providers_mod.get_provider_profile = lambda name: profile+ orig_creds = models_mod._api_key_credentials+ models_mod._api_key_credentials = lambda normalized: ("test-key", None)+ try:+ assert _profile_live_catalog("acme-acp") == ["acme-pro"]+ finally:+ if orig is not None:+ providers_mod.get_provider_profile = orig+ models_mod._api_key_credentials = orig_creds++def test_external_process_providers_in_model_options_payload(monkeypatch):"""Layer 1 admits it into CANONICAL_PROVIDERS; layer 2 (inventory) seats arow with a self-named model, reachability as the credential."""