fix(codex): isolate continuation state per Claude Agent - #96
Merged
Conversation
ItsAlbertZhang
marked this pull request as ready for review
August 2, 2026 13:22
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
raine
force-pushed
the
fix/codex-agent-continuation
branch
from
August 2, 2026 14:52
798ebd8 to
a5d4e4c
Compare
Owner
|
Thanks @ItsAlbertZhang for the thorough fix and comprehensive regression coverage! |
Contributor
Author
Owner
|
A little mishap, sorry for the confusion |
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.
Summary
Claude Code SubAgents naturally share a session ID while carrying distinct direct Agent IDs. Codex continuation state was previously keyed only by the shared session, allowing Main and sibling Agents to consume or supersede one another's continuation and reusable WebSocket state.
This PR provides the narrowest safe end-to-end behavioral fix for issue #95:
The behavioral scope is intentionally narrow, although the implementation and regression coverage cross HTTP ingress, continuation state, and WebSocket lifecycle boundaries.
Ownership model
Continuation identity is defined as:
session ID(session ID, direct Agent ID)Missing, malformed, duplicated, or ambiguous identity does not reject the HTTP request. It disables continuation and reusable-socket state for that request.
Detected auto-review classifier requests are also stateless.
Socket provenance and recovery
A reusable response ID remains bound to the exact live WebSocket that produced it. It is never moved to a new or replacement connection.
If the originating socket is missing, dead, or replaced, Codex continuation performs at most one full-context recovery attempt without the stale response ID.
Provider-controlled live retries preserve the logical continuation reservation while closing the abandoned attempt socket. Genuine downstream cancellation still clears continuation and compaction state during retry backoff, replacement startup, and post-first-chunk streaming.
Same-owner stale completions cannot overwrite newer state, while completion ordering across different owners remains independent.
Compatibility
Existing public Rust forms remain source-compatible.
Direct use of legacy continuation recording without socket provenance intentionally fails closed and cannot publish reusable continuation state. This PR does not claim full behavioral compatibility for that unsupported low-level path.
Existing feature defaults are unchanged, and continuation state remains in-memory only.
Validation
cargo fmt --all -- --checkgit diff --checkcargo check --locked --all-targetscargo test --locked --all-targets -- --test-threads=1public_codex_api_compatcodex_agent_continuationsmoke_codexcoveragecargo clippy --locked --all-targetsTests used local mocks and an isolated configuration directory. No live-wire provider or OAuth testing was performed.
Non-goals
This PR does not change:
Addresses #95
🤖 Generated with Claude Code