Skip to content

Fix Codex app-server ownership and protocol admission - #386

Merged
myobie merged 5 commits into
mainfrom
agent/codex-protocol-admission
Aug 31, 2026
Merged

Fix Codex app-server ownership and protocol admission#386
myobie merged 5 commits into
mainfrom
agent/codex-protocol-admission

Conversation

@myobie

@myobie myobie commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Reap each Codex app-server process group when its wrapper exits or dies.
  • Replace the exact Codex CLI version list with a generated app-server schema check.
  • Refuse startup only when a required protocol element is missing or a critical shape changes.
  • Admit additive item kinds and server requests.
  • Hold delivery when the runtime sees an unreviewed item kind or server request.
  • Send one idempotent rejection message to the declared supervisor after a true startup refusal.

Runtime safety

A listed additive element is reviewed and safe to ignore. An unlisted item kind or server request creates an unknownProtocol hold. An idle thread status releases the hold.

The app-server runs in a dedicated process group. A watchdog detects wrapper death and kills that exact group. Rust cleanup removes the socket after normal exits and error returns.

A crash can leave one dead socket file. The next launch proves that the socket has no listener, removes it, and binds the same path.

Evidence

The old version gate rejected codex-cli 0.150.0 before it inspected the protocol. The new gate accepts the real generated schemas from Codex 0.145.0, 0.146.0, 0.150.0, and 0.151.0.

The red-first unknown-item test failed because the runtime stayed active. It passes after the fail-closed hold change.

The wrapper-death test proves four facts: the group dies, the dead socket remains, connection fails with ConnectionRefused, and the next launch recovers the path. The test passes in debug and release profiles.

The current combined checks pass:

  • 53 Codex app-server unit tests
  • 4 Codex app-server integration tests
  • cargo test --lib --all-features: 24 agent-spec, 563 st2, and 7 st2-wire tests
  • git diff --check

No eval ran because the fleet eval stop remains active.

Scope

The installed Codex binary pin is not part of this work. The fleet policy uses deliberate updates with protocol checks.

Claude needs no matching version gate. Its MCP connection negotiates the protocol version.

Accepted tradeoff

This change replaces the exact Codex version and fingerprint allowlist with structural compatibility checks. A genuinely incompatible release can progress until a required shape check or runtime hold catches it. We accept this cost because exact allowlists stranded compatible installed releases.

@myobie myobie changed the title Fix Codex app-server protocol admission Fix Codex app-server ownership and protocol admission Aug 29, 2026
@myobie
myobie force-pushed the agent/codex-protocol-admission branch from a9f1a13 to a1a07d0 Compare August 29, 2026 20:01
@myobie
myobie marked this pull request as ready for review August 29, 2026 21:54
@myobie
myobie force-pushed the agent/codex-protocol-admission branch from b283c20 to 0c3a0dd Compare August 30, 2026 00:58
@schickling

Copy link
Copy Markdown
Contributor

@codex

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 30, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-08-30T16:00:07.520681Z 0c3a0dd Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0c3a0dd950

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/codex_app_server.rs
Comment on lines +3124 to +3128
require_methods(
&schemas.client_requests,
REQUIRED_CODEX_CLIENT_REQUESTS,
"client request",
)?;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Validate each method arm against its payload schema

The admission gate checks only that each required method literal exists, while the later shape checks inspect conventionally named definitions in isolation. If a later Codex release retains turn/start (or another required method) and the legacy definitions but rewires that method arm to different params, this gate admits it even though st2 continues sending the old payload and native delivery then fails at runtime. Resolve each required method arm and verify that its params schema is the expected definition rather than treating method presence and unused definitions as independent evidence.

Useful? React with 👍 / 👎.

@myobie
myobie merged commit 9bcda78 into main Aug 31, 2026
2 checks passed
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