feat(chat-runtime): Codex harness adapter over app-server JSON-RPC with recorded fixtures
Stacked on #6167 (sibling of #6193). rpcClient (stdio JSON-RPC, version gate — initialize advertises no capabilities, so the doc's feature-detect rule is unimplementable and amended), mapThreadItem, wire fixtures for six real scenarios incl. a full server-initiated approval round trip and mid-stream interrupt (codex-cli 0.143.0). 25 new tests (94/2skip package-wide on branch); live smoke passed 6.08s then re-skipped. Extracts shared harness/eventQueue used by fake + codex. 11 wire-truth mismatches vs plan §6 documented in the report — doc amendments follow.
https://claude.ai/code/session_01XRFCEPsfmJHu2SenDKYJ2h
Summary by cubic
Adds a Codex harness adapter that talks app-server JSON-RPC over stdio and maps Codex threads/turns/items and approvals into the chat protocol. Gates Codex < 0.143.0 and hardens stream handling for malformed frames and early cancels, with fixture-backed tests that reflect real wire behavior.
-
New Features
CodexAdapterover stdio JSON-RPC withrpcClientandwireschemas; unknown notifications appear as notice items; avoids@openai/codex-sdkto preserve tool args and diff text.- Version gate via
userAgent: if < 0.143.0, emit a notice and end the session with status "dead". - Six recorded fixtures +
FixturePlayerandscripts/recordCodexFixtures.ts. - Approval flow with decision options and server-initiated requests; mid-stream interrupt handling.
- File edit/change mapping with diff parsing; terminal/text deltas; plan updates.
- Shared
EventQueue; codex modes (read-only,auto,full-access) and turn policy helpers; live smoke test scaffold (skipped) for thecodexbinary on PATH.
-
Bug Fixes
- Contain frame parsing/dispatch errors: emit an error notice and keep streaming; reply with an error to unreadable server requests to avoid hangs.
- Honor early cancel during the
turn/starthandshake and apply as soon as the turn id arrives. - Preserve a zero
modelContextWindowinstead of dropping it as falsy.
Summary by CodeRabbit
-
New Features
- Added Codex app-server integration for chat sessions, streamed responses, commands, file changes, searches, and usage reporting.
- Added support for approval workflows, sandbox modes, session resume, cancellation, and interrupted turns.
- Added clear handling for unsupported Codex versions and unexpected protocol activity.
-
Documentation
- Updated the reading guide with Codex integration details, configuration behavior, and fixture recording instructions.
-
Tests
- Added broad coverage for Codex conversations, tools, approvals, file edits, interruptions, and resilience.