Skip to content

[P0.20] Rewrite the Codex adapter against the real app-server protocol #914

Description

@frankbria

Filed by the SaaS launch review. Priority P0.20 — severity critical, category unfinished.

Problem

Verified against the schema from codex-cli 0.142.5: InitializeParams requires clientInfo but the adapter sends {"capabilities": {}}, so the server returns a JSON-RPC error, the adapter's '"result" not in response' check trips and every run dies at handshake. thread/start and turn/start are sent id-less with invented params; the event loop waits for session_started/notification/tool_call, none of which exist in ServerNotification, and replies with an invented tool_call/approved. Transport is broken too: _recv_line mixes selectors with a buffered TextIOWrapper so a burst ending in turn/completed strands and stall-times-out after 5 minutes, and it returns None for both EOF and JSONDecodeError so one stray non-JSON log line aborts a live turn as 'Process terminated unexpectedly'. --engine codex is advertised in the README and cannot work at all.

Evidence

  • codeframe/core/adapters/codex.py:224
  • codeframe/core/adapters/codex.py:241
  • codeframe/core/adapters/codex.py:299
  • codeframe/core/adapters/codex.py:181
  • codeframe/core/adapters/codex.py:180

Acceptance criteria

  • Handshake and turn flow match the generated schema (initialize with clientInfo; thread/start and turn/start as id-carrying requests with cwd / threadId+input); approvals answered by request id; JSON-RPC error responses handled explicitly
  • stdout is drained without mixing select() and buffered reads; malformed JSON is logged and skipped, distinct from EOF; a test writes a burst of JSON lines followed by silence and asserts no stall timeout
  • A contract test validates outbound messages against a checked-in generate-json-schema fixture
  • The codex engine stays registered and advertised - de-registering it is no longer an acceptable outcome under the launch scope decision; the adapter must pass the real-binary contract tier before launch

Atomic by construction: one developer, one focused session.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions