Add OpenAI Codex agent backend behind a multi-backend engine seam#176
Merged
Conversation
…re-image snapshots
…kind/approval shapes, CRLF diffs
…t dead on reader exit
…int forks, managed ultracode layer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Runs Nerve sessions on OpenAI Codex (GPT-5.6 family via
codex app-server, JSON-RPC 2.0 over stdio) with full parity to the Claude path — interactive web sessions, Telegram, cron, wakeups, forks, resume — behind a clean backend abstraction.Claude remains the default. The backend is selected by config (
agent.backend,agent.cron_backend, per-sessionbackend_override) and is sticky per session: existing sessions and their wakeups stay on their original backend.Key pieces
nerve/agent/backends/):AgentEnginedecoupled fromclaude_agent_sdk; runtime-agnostic event stream translated into the existing broadcaster/turn-state machinery.backends/codex/): app-server transport (tolerates >64KiB JSONL lines, marks client dead on reader exit), thread/turn lifecycle, exact-point forks, narrow resume-miss recovery, command/file-change approval bridging into the existing interactive-pause UX, structured user-input/plan/output bridges.nerve/mcp_server/loopback.py): dedicated ASGI serving of Nerve's tools to codex subprocesses with aud-scoped, session-claimed, expiring JWTs (8h session / 2h worker, unique jti).None; ChatGPT-plan estimates kept separate from billed cost.scripts/check_codex_schema.pyguards drift).Out of scope (v1)
Langfuse tracing for codex turns, permission-grant approvals (declined safely via JSON-RPC error → codex continues sandboxed),
turn/steer, mixed-backend forking (guard refuses), PDF inputs on codex.Testing
pytest tests/— 1533 passed, 2 skipped (new suites: appserver transport, ingester, integrity migration, loopback MCP, ultracode integration, backend selection, MCP session binding)npm run buildclean; live smoke against codex-cli 0.144.1 (defaults corrected from smoke:gpt-5.6-sol, reverse-diff pre-image snapshots)backend: claudedefault = zero behavior change.