Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -1032,9 +1032,9 @@ agent:
cron_backend: null # null → backend; new cron/hook sessions only

codex: # active when a codex backend is selected
bin_path: codex # tested: >= 0.153.1 and < 0.165.0
bin_path: codex # tested: >= 0.153.1 and < 0.170.0
min_version: 0.153.1
max_version: 0.165.0
max_version: 0.170.0
home_dir: ~/.nerve/codex # isolated CODEX_HOME (auth, config, sessions)
model: gpt-5.6-sol
cron_model: null # null → model
Expand Down
2 changes: 1 addition & 1 deletion nerve/agent/backends/codex/appserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
flowing while an approval is pending, and interrupts stay responsive.

Protocol shapes verified against the schema exported from codex-cli
0.164.0 (``codex app-server generate-json-schema``); see
0.169.0 (``codex app-server generate-json-schema``); see
``tests/fixtures/codex_schema_meta.json``. Parsing is defensive:
unknown notifications are debug-logged, unknown server requests get a
safe response, missing fields never raise.
Expand Down
4 changes: 2 additions & 2 deletions nerve/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3758,7 +3758,7 @@ class CodexConfig:

bin_path: str = "codex" # PATH-resolved codex binary
min_version: str = "0.153.1" # inclusive tested protocol range
max_version: str = "0.165.0" # exclusive
max_version: str = "0.170.0" # exclusive
home_dir: str = field(default_factory=lambda: str(paths.nerve_path("codex"))) # isolated CODEX_HOME (auth/config/sessions)
model: str = "gpt-5.6-sol"
cron_model: str = "" # empty → model
Expand Down Expand Up @@ -3836,7 +3836,7 @@ def from_dict(cls, d: dict) -> "CodexConfig":
return cls(
bin_path=str(d.get("bin_path", "codex")),
min_version=str(d.get("min_version", "0.153.1")),
max_version=str(d.get("max_version", "0.165.0")),
max_version=str(d.get("max_version", "0.170.0")),
home_dir=_setting_str(
d.get("home_dir"), str(paths.nerve_path("codex"))
),
Expand Down
8 changes: 4 additions & 4 deletions tests/fixtures/codex_schema_meta.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"codex_cli_version": "0.164.0",
"codex_cli_version": "0.169.0",
"generated_with": "codex app-server generate-json-schema",
"verified_date": "2026-10-23",
"canonical_v2_schema_sha256": "25febad0b85cbf3de2b841abfb716c5843e0b7d20fce7cfa40eb03c0d4214d17",
"verified_date": "2026-11-14",
"canonical_v2_schema_sha256": "3ac1cefefbf381ab50ab3247d65a28a19c745fa86ee9210d0890d21f2ec577ef",
"required_methods": [
"initialize",
"account/read",
Expand All @@ -14,5 +14,5 @@
"turn/start",
"turn/interrupt"
],
"notes": "Canonical JSON hash is stable across generator output ordering. Regenerate with scripts/check_codex_schema.py when changing the tested CLI range. 0.155.1 -> 0.164.0: 32 definitions added, 49 changed. Removed: thread/rollback (ThreadRollbackParams, ThreadRollbackResponse), ConfigRequirements.windowsSandboxPrivateDesktop, ModelProviderCapabilitiesReadResponse.namespaceTools; nerve uses none of them. Every method and notification nerve uses is still present. Changes in shapes nerve uses are additive or optional: UserInput image takes url or fileId (nerve sends url), new optional TurnStartParams.parentTurnId/rootTurnId/disabledPluginIds, Turn.rootTurnId, McpServerStatus.httpOrigin/serverCapabilities/toolListMeta, ThreadItem mcpToolCall.mcpAppUi, subAgentActivity.model/reasoningEffort, imageGeneration result or fileId, new notifications thread/readState/changed, thread/prediction/updated, account/gatewayOAuth/changed."
"notes": "Canonical JSON hash is stable across generator output ordering. Regenerate with scripts/check_codex_schema.py when changing the tested CLI range. 0.164.0 -> 0.169.0: 32 definitions added, 32 changed, none removed. Added client methods account/securitySetup/read, modelProvider/config/write and modelProvider/list, plus server notification thread/section/changed; server-initiated request methods are unchanged. Every method nerve uses is still present, and changes in request shapes nerve sends are additive or optional. Potentially breaking removals are unused by nerve: ReviewDelivery no longer accepts detached, and URL payload fields were removed from audio user/content/function-output variants."
}
21 changes: 20 additions & 1 deletion tests/test_codex_appserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
import pytest

from nerve.agent.backends import (
BackendDeps, ForkSourceMissingError, SessionSpec, TransportDiedError,
BackendDeps, BackendError, ForkSourceMissingError, SessionSpec,
TransportDiedError,
)
from nerve.agent.backends import events as ev
from nerve.agent.backends.codex import CodexBackend
Expand Down Expand Up @@ -95,6 +96,24 @@ def _mode(monkeypatch, mode: str) -> None:
monkeypatch.setenv("FAKE_CODEX_MODE", mode)


@pytest.mark.asyncio
@pytest.mark.parametrize(("version", "accepted"), [
("0.153.0", False),
("0.153.1", True),
("0.164.0", True),
("0.169.0", True),
("0.170.0", False),
])
async def test_supported_codex_version_range(tmp_path, monkeypatch, version, accepted):
monkeypatch.setenv("FAKE_CODEX_VERSION", version)
backend = CodexBackend(_deps(_config(tmp_path)))
if accepted:
assert await backend._check_cli_version() == f"codex-cli {version}"
else:
with pytest.raises(BackendError, match=r">=0\.153\.1, <0\.170\.0"):
await backend._check_cli_version()


@pytest.mark.asyncio
async def test_basic_turn_streams_and_completes(tmp_path, monkeypatch):
_mode(monkeypatch, "basic")
Expand Down