The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(runtime): model.openai_runtime: codex_app_server applies to provider "openai" again
teknium135cea9b87e48
diff --git a/hermes_cli/runtime_provider.py b/hermes_cli/runtime_provider.pyindex 87075496ee9..0d9714cefa7 100644--- a/hermes_cli/runtime_provider.py+++ b/hermes_cli/runtime_provider.py@@ -270,7 +270,8 @@ def _maybe_apply_codex_app_server_runtime(*, provider: str, api_mode: str, modelruntime ``resolve_runtime_provider`` picked — never inside an individual ladder rung."""if not model_cfg or str(model_cfg.get("openai_runtime") or "").strip().lower() != "codex_app_server":return api_mode- if provider in {"openai", "openai-codex"} or (provider == "custom" and codex_model_provider_id(requested_provider)):+ if provider in {"openai", "openai-codex"} or requested_provider in {"openai", "openai-codex"} \+ or (provider == "custom" and codex_model_provider_id(requested_provider)):return "codex_app_server"return api_mode@@ -941,6 +942,9 @@ def resolve_runtime_provider(*, requested: Optional[str] = None, explicit_api_ke_raise_if_provider_disabled(requested_provider)# Same alias expansion the auxiliary client applies, so ``provider: openai`` means one thing on# every path (background review, curator, MoA slots, delegation) instead of "Unknown provider".+ # The pre-expansion name is what the codex_app_server overlay judges: ``openai`` is eligible,+ # the anonymous ``custom`` it expands to is not.+ requested_alias = requested_providerrequested_provider, explicit_base_url = expand_direct_api_alias(requested_provider, explicit_base_url)_raise_if_local_alias_missing_endpoint(requested_provider, explicit_base_url)runtime = next(r for r in _ladder_rungs(requested_provider, explicit_api_key, explicit_base_url, target_model) if r)@@ -950,7 +954,7 @@ def resolve_runtime_provider(*, requested: Optional[str] = None, explicit_api_ke# so applying the opt-in inside one rung left the others on codex_responses (#115169).api_mode = _maybe_apply_codex_app_server_runtime(provider=runtime.get("provider", ""), api_mode=runtime.get("api_mode", ""), model_cfg=_get_model_config(),- requested_provider=requested_provider)+ requested_provider=requested_alias)if api_mode != runtime.get("api_mode"):logger.info("model.openai_runtime=codex_app_server overrides the %s runtime (source=%s); its credential/endpoint ""is not used — the app-server authenticates with its own login", runtime.get("provider"), runtime.get("source"))diff --git a/tests/hermes_cli/test_runtime_provider_resolution.py b/tests/hermes_cli/test_runtime_provider_resolution.pyindex 4de4e8c52c9..0798424efe6 100644--- a/tests/hermes_cli/test_runtime_provider_resolution.py+++ b/tests/hermes_cli/test_runtime_provider_resolution.py@@ -2135,6 +2135,19 @@ def test_openai_runtime_unset_keeps_wire_api_mode(monkeypatch, rung, openai_runtassert rp.resolve_runtime_provider(requested="openai-codex", **kwargs)["api_mode"] == "codex_responses"+def test_openai_runtime_codex_app_server_survives_the_openai_to_custom_alias_expansion(monkeypatch):+ """``provider: openai`` expands to the anonymous ``custom`` runtime (#116055) before the overlay runs;+ the overlay must judge the name the user configured, or the documented ``openai`` opt-in is a silent no-op."""+ monkeypatch.setattr(rp, "load_pool", lambda _p: SimpleNamespace(has_credentials=lambda: False))+ monkeypatch.setattr(rp, "_get_model_config", lambda: {+ "provider": "openai", "default": "gpt-5.5-codex", "openai_runtime": "codex_app_server"})++ resolved = rp.resolve_runtime_provider(requested="openai", explicit_api_key="sk-explicit")++ assert resolved["provider"] == "custom" # the alias expansion itself is unchanged+ assert resolved["api_mode"] == "codex_app_server"++# ── #116055: ``provider: openai`` means the same thing on both auxiliary paths ──────────────────def test_openai_alias_resolves_identically_on_runtime_and_aux_client_paths(monkeypatch):