Skip to content

Hold App Server messages in tests to Codex's own schema - #3383

Merged
max-sixty merged 2 commits into
mainfrom
agent-a9ec9037214266313
Oct 20, 2026
Merged

max-sixty merged 2 commits into
mainfrom
agent-a9ec9037214266313

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

The tests' App Server notifications were written by hand from what Leaf reads, so a fixture could carry a shape Codex never sends and still pass. This change is test-only.

Checking. tests/conftest.py generates Codex's protocol schema from the @openai/codex that package.json pins (codex app-server generate-json-schema --experimental, run from node_modules/.bin, which wt setup installs locally and in CI), once per worker into a temporary directory, and checks each message against its method's branch:

  • app_server_messages, an autouse fixture, checks every message a test hands AppServerEvents or TaskConnection (stand-in or hand-built) and every message a test asks app_server_delivery_id about. Readers can run on their own threads, so violations, and a check that could not run, are collected and fail the test at its end.
  • The app_server stand-in (tests/interact_support.py) checks both directions: what Leaf sends it and what it sends back.
  • The website dispatch test checks the turn/interrupt and turn/start it captures and the completion its fake socket returns.

Over the focused selection, Leaf's requests seen were initialize, initialized, thread/start, thread/resume, thread/turns/list, turn/start, config/read and turn/interrupt; every one already held the schema, including turn/start's toolOutput and turnTrigger.

Fixtures fixed. Turns lacked items and status; command items their command, commandActions, cwd and status; item notifications their threadId, turnId and timestamps; thread statuses their type or activeFlags; a reasoning delta its summaryIndex; and approval and user-input requests were sent as notifications without an id or itemId. Most were added mechanically, so the diff in test_codex_app_server.py is wide but changes no assertion.

Not covered. Messages leaf_website reads in its own loops (for example _end_unfollowed_turn) from a test's fake socket are checked only where the test checks them, as the dispatch test now does. Responses ({id, result}) aren't checked, since their shape depends on the request.

Checks: the focused Codex, thread-title, response, hook, stop-guard, delivery and website-server tests, pre-commit, and an independent Codex review. It found two gaps, both fixed: app_server_delivery_id fixtures and the dispatch socket bypassed the check, and a failure to generate the schema would have been swallowed on a reader thread. tests/journeys/test_codex_adapter.py::test_codex_delivery_outlives_the_starting_command_and_acknowledges errors on main as well.

This was written by Claude Code on behalf of max-sixty

max-sixty and others added 2 commits October 20, 2026 15:30
The tests' App Server notifications were written by hand from what Leaf
reads, so a fixture could carry a shape Codex never sends and still pass.
The suite now generates Codex's protocol schema from the `@openai/codex` that
`package.json` pins (`codex app-server generate-json-schema --experimental`,
from `node_modules`, which `wt setup` installs), once per worker and
uncommitted, and checks each message by its method:

- `app_server_messages`, an autouse fixture, checks every message a test hands
  `AppServerEvents` or `TaskConnection`, whether a stand-in sent it or the
  test built it, and every message a test asks `app_server_delivery_id`
  about. A reader may run on its own thread, so what it finds, a check that
  could not run included, fails the test at its end;
- the `app_server` stand-in checks what Leaf sends it (initialize,
  initialized, thread/start, thread/resume, thread/turns/list, turn/start,
  config/read) and what the stand-in sends back;
- the website dispatch test checks the turn/interrupt and turn/start it
  captures and the completion its socket returns.

Every request Leaf sends already held the schema. The fixtures did not:
turns lacked `items` and `status`, command items their `command`,
`commandActions`, `cwd` and `status`, item notifications their `threadId`,
`turnId` and timestamps, thread statuses their `type` or `activeFlags`, a
reasoning delta its `summaryIndex`, and approval and user-input requests were
sent as notifications without an `id` or `itemId`. Each now carries what
Codex sends.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit b6c8811 into main Oct 20, 2026
3 checks passed
@max-sixty
max-sixty deleted the agent-a9ec9037214266313 branch October 20, 2026 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants