Skip to content

The agent that grows with you

test: trim codex_bin coverage to two invariants; tighten docs

teknium14b8bac1a5a0f
diff --git a/tests/agent/test_codex_app_server_integration.py b/tests/agent/test_codex_app_server_integration.py
index 9ecc257d4b7..0500f8115ec 100644
--- a/tests/agent/test_codex_app_server_integration.py
+++ b/tests/agent/test_codex_app_server_integration.py
@@ -379,6 +379,7 @@ class TestRunConversationCodexPath:
assert captured["cwd"] == str(tmp_path)
def test_configured_codex_binary_seeds_app_server_session(self, monkeypatch):
+ """A codex_app_server turn spawns ``model.codex_bin``, not bare ``codex`` (#61360)."""
configured = "/Applications/Codex.app/Contents/Resources/codex"
captured: dict = {}
diff --git a/tests/agent/transports/test_codex_app_server_runtime.py b/tests/agent/transports/test_codex_app_server_runtime.py
index 56db322b95c..b3cae82c3a1 100644
--- a/tests/agent/transports/test_codex_app_server_runtime.py
+++ b/tests/agent/transports/test_codex_app_server_runtime.py
@@ -274,43 +274,6 @@ class TestSpawnEnvIsolation:
"subprocesses (gh, git, aws, npm) need the user's real HOME."
)
- def test_configured_binary_path_with_spaces_is_one_argv_element(
- self, monkeypatch
- ):
- import subprocess
- from agent.transports import codex_app_server as cas
-
- captured = {}
-
- class FakePopen:
- def __init__(self, cmd, *args, **kwargs):
- captured["cmd"] = list(cmd)
- self.stdin = None
- self.stdout = None
- self.stderr = None
- self.pid = 1
- self.returncode = None
-
- def poll(self):
- return None
-
- def terminate(self):
- pass
-
- def wait(self, timeout=None):
- return 0
-
- def kill(self):
- pass
-
- monkeypatch.setattr(subprocess, "Popen", FakePopen)
- configured = "/Applications/Codex Preview.app/Contents/Resources/codex"
-
- client = cas.CodexAppServerClient(codex_bin=configured)
- client._closed = True
-
- assert captured["cmd"][:2] == [configured, "app-server"]
-
def test_spawn_env_sets_CODEX_HOME_when_provided(self, monkeypatch):
"""CODEX_HOME isolation must still work — that's the whole point
of the codex_home arg."""
diff --git a/tests/hermes_cli/test_codex_runtime_plugin_migration.py b/tests/hermes_cli/test_codex_runtime_plugin_migration.py
index cc9e741df20..d2eb58b2f51 100644
--- a/tests/hermes_cli/test_codex_runtime_plugin_migration.py
+++ b/tests/hermes_cli/test_codex_runtime_plugin_migration.py
@@ -185,29 +185,6 @@ class TestMigrate:
assert "google-calendar@openai-curated" in report.migrated_plugins
assert "github@openai-curated" in report.migrated_plugins
- def test_plugin_discovery_uses_configured_codex_binary(
- self, tmp_path, monkeypatch
- ):
- from hermes_cli import codex_runtime_plugin_migration as crpm
-
- captured = {}
-
- def fake_query(codex_home=None, timeout=8.0, codex_bin="codex"):
- captured["codex_bin"] = codex_bin
- return [], None
-
- monkeypatch.setattr(crpm, "_query_codex_plugins", fake_query)
- configured = "/Applications/Codex.app/Contents/Resources/codex"
-
- migrate(
- {"model": {"codex_bin": configured}},
- codex_home=tmp_path,
- discover_plugins=True,
- expose_hermes_tools=False,
- )
-
- assert captured["codex_bin"] == configured
-
def test_plugin_discovery_failure_non_fatal(self, tmp_path, monkeypatch):
"""If codex isn't installed or RPC fails, MCP migration still
completes. The error surfaces in the report but doesn't abort."""
diff --git a/tests/hermes_cli/test_codex_runtime_switch.py b/tests/hermes_cli/test_codex_runtime_switch.py
index 36ed4b1af0a..ce5b9efccd0 100644
--- a/tests/hermes_cli/test_codex_runtime_switch.py
+++ b/tests/hermes_cli/test_codex_runtime_switch.py
@@ -45,24 +45,6 @@ class TestGetCurrentRuntime:
) == "auto"
-class TestGetConfiguredCodexBinary:
- def test_defaults_for_missing_or_invalid_values(self):
- assert crs.get_configured_codex_binary({}) == "codex"
- assert crs.get_configured_codex_binary({"model": {}}) == "codex"
- assert crs.get_configured_codex_binary(
- {"model": {"codex_bin": ""}}
- ) == "codex"
- assert crs.get_configured_codex_binary(
- {"model": {"codex_bin": 42}}
- ) == "codex"
-
- def test_returns_trimmed_configured_path(self):
- configured = "/Applications/Codex.app/Contents/Resources/codex"
- assert crs.get_configured_codex_binary(
- {"model": {"codex_bin": f" {configured} "}}
- ) == configured
-
-
class TestSetRuntime:
def test_creates_model_section_if_missing(self):
cfg = {}
@@ -78,6 +60,7 @@ class TestSetRuntime:
class TestApply:
def test_binary_check_uses_configured_path(self):
+ """/codex-runtime must probe ``model.codex_bin``, not bare ``codex`` from PATH (#61360)."""
configured = "/Applications/Codex.app/Contents/Resources/codex"
cfg = {
"model": {
diff --git a/website/docs/user-guide/features/codex-app-server-runtime.md b/website/docs/user-guide/features/codex-app-server-runtime.md
index e3eaeb63f31..dc7d820feed 100644
--- a/website/docs/user-guide/features/codex-app-server-runtime.md
+++ b/website/docs/user-guide/features/codex-app-server-runtime.md
@@ -197,18 +197,19 @@ model:
openai_runtime: codex_app_server # default is "auto" (= Hermes runtime)
```
-If the Hermes process cannot resolve `codex` from `PATH` (common for gateway
-services and desktop-launched workers), configure the executable explicitly:
+If the Hermes process cannot resolve `codex` from `PATH` — typical for gateway services,
+cron and Kanban workers, or a desktop-bundled CLI — and the first turn fails with
+`No such file or directory: 'codex'`, point the runtime at the executable explicitly:
```yaml
model:
openai_runtime: codex_app_server
- codex_bin: /Applications/Codex.app/Contents/Resources/codex
+ codex_bin: /Applications/Codex.app/Contents/Resources/codex # default: "codex" from PATH
```
-The configured path is used consistently for the enablement check, native
-plugin discovery, and the long-lived app-server subprocess. Paths containing
-spaces are passed as a single subprocess argument; do not add shell quoting.
+`model.codex_bin` is used everywhere Hermes spawns codex: the `/codex-runtime` availability
+check, native plugin discovery during migration, and the long-lived app-server subprocess.
+The value is a single executable path, not a shell command — no quoting or extra arguments.
## Self-improvement loop (memory + skill nudges)