chore(sdk): Codex: client-side initialize handshake, auth.json bootstrap, full-auto launch, send resilience#139
Open
ross-rl wants to merge 10 commits into
Open
Conversation
The answer form replied with an empty questions array, which fails the tool's input schema (questions requires >=1 items). Echo the model's original input and merge answers into it. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The codex_json broker mount does not perform the app-server initialize handshake, so requests failed with -32600 "Not initialized". Add CodexAxonConnection.initialize() (initialize request + initialized notification) mirroring the Claude connection lifecycle, with isInitialized/initializeResponse getters and initializeParams overrides. A server-side already-initialized rejection is treated as success so reconnecting to a live app-server still works. Docs updated to show the connect() -> initialize() flow. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Codex reads credentials from ~/.codex/auth.json rather than the OPENAI_API_KEY env var, so codex devboxes now materialize an api-key-mode auth file at launch (via python3 json.dumps for safe quoting). Also run the new initialize() handshake after connect. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ends in combined-app - Write ~/.codex/auth.json from CODEX_AUTH_JSON (full file contents, e.g. $(cat ~/.codex/auth.json) for ChatGPT-plan auth) or fall back to api-key mode from OPENAI_API_KEY; validated server-side. - Launch codex app-server full-auto by default (-c approval_policy=never -c sandbox_mode=danger-full-access, the app-server equivalent of --dangerously-bypass-approvals-and-sandbox), skipped when interactive approvals are enabled; client launchArgs pass through. - Re-wire the connection before send if the SSE stream silently died (the SDK retries a dropped stream once per connection lifetime), resuming from the last seen sequence to avoid duplicate history. - Run the initialize handshake once per devbox instead of on every subscribe/rewire. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Intercept messages starting with "/" and map them onto app-server JSON-RPC methods instead of starting a turn: /plan and /default toggle sticky turn/start overrides (read-only sandbox + on-request approvals vs. the configured default), /model and /effort set per-turn overrides, /compact runs thread/compact/start, /review runs review/start (uncommitted changes or custom instructions), /help lists commands. Confirmations surface as system_note WS events rendered as system chat items; unrecognized commands fall through as normal prompts. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
/plan and friends previously only broadcast a transient WS message, so mode changes were invisible in the axon event log and lost on resubscribe. Publish app/system_note EXTERNAL_EVENTs instead and render them from the timeline, which covers live delivery and replay with one path. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
/plan previously faked plan mode with sandbox/approval overrides. The
current app-server protocol supports it natively: turn/start accepts
collaborationMode { mode: "plan" | "default", settings } (newer than
the vendored protocol types, sent via conn.request). settings requires
a model, so the manager mirrors the thread's live model/effort from
thread/settings/updated notifications, with /model and /effort
overrides taking precedence and developer_instructions: null selecting
the mode's built-in instructions.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
turn/start.collaborationMode is gated behind the experimentalApi initialize capability (#[experimental] in codex-rs); without the opt-in the app-server rejects the request. Declare the capability when wiring the combined-app codex connection. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
/plan depended on a thread/settings/updated notification to learn the thread's model (required by collaborationMode.settings); when it never fired the next turn silently went out without plan mode. Resolve the model eagerly at /plan time (overrides -> live settings -> config/read) and cache it, warn in-chat if a message ever goes out without the requested mode, and log outgoing turn/start overrides server-side. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Stacked on #-/feat/codex-examples-docs. Fixes found while testing the codex path in the combined-app.
SDK
CodexAxonConnection.initialize()— thecodex_jsonbroker mount does not perform the app-server handshake, so all requests failed with-32600 "Not initialized". The connection now runs theinitializerequest +initializednotification itself, mirroring the Claude lifecycle (connect()→initialize()), withisInitialized/initializeResponsegetters,initializeParamsoverrides, and tolerance for a server-side "already initialized" rejection (live app-server reattach). Four new tests.Examples
AskUserQuestionpermission responses (emptyquestionsarray failed the tool input schema — echo the original input and mergeanswers); write~/.codex/auth.jsonat devbox launch fromCODEX_AUTH_JSON(full file contents, ChatGPT-plan auth) orOPENAI_API_KEY(api-key mode), validated server-side; launch codex full-auto by default (-c approval_policy=never -c sandbox_mode=danger-full-access, the app-server equivalent of--dangerously-bypass-approvals-and-sandbox), skipped when interactive approvals are on; re-wire the connection before send if the SSE stream silently died (SDK retries a dropped stream once per connection lifetime), resuming from the last seen sequence; run the handshake once per devbox instead of on every subscribe/rewire.auth.jsonfor codex devboxes; runinitialize()after connect.Docs
connect()→initialize()flow and the auth.json launch-command pattern.Known follow-ups
🤖 Generated with Claude Code