Repository navigation
fix(codex): route oversized full-context Auto requests over gzipped HTTP and isolate ephemeral forks - #216
Open
chris7iu wants to merge 1 commit into
Conversation
…TTP and isolate ephemeral forks
This branch has not been deployed
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
Fixes long-context Codex
Autotransport stalls and retry loops observed on multi-megabyte (~350k+ token / ~11.5 MB) sessions:Pre-send gzipped HTTP routing for oversized full-context
Autorequests (src/config.rs,src/providers/codex/client.rs):codex.autoWebSocketMaxBytes/CCP_CODEX_AUTO_WS_MAX_BYTES(default4 MiB;0disables).Autotransport hasrequestCompression+ HTTP fallback enabled and is sending a full-context request (previous_response_id == None, or pre-sendWEBSOCKET_CONTINUATION_SOCKET_MISSINGwhen pooled socket is absent/dead) whose serialized JSON exceedsautoWebSocketMaxBytes, bypasses WebSocket pre-send and dispatches directly over gzip-compressed HTTP.previous_response_iddelta stay on WebSocket regardless of total conversation size, andshould_fallback_to_httpremains strictly pre-send (preserving the no-post-send-HTTP-replay invariant).Isolate Claude Code background/ephemeral forks (
src/providers/codex/translate/request.rs,src/providers/codex/compaction.rs,src/providers/codex/mod.rs):FE(...)forks (away_summary,prompt_suggestion,agent_summary,rename,side_question/btwinside<system-reminder>,extract_memories,auto_dream).ConversationIdentity::Agent(session_id, fork_label)and uses non-mutatingcompaction::peek_compaction_replay(compaction_attempt = None) so aborted or mismatched background forks never clobber the main session'sprevious_response_id, pooled WebSocket, orCompactionState.Fix premature
502bailout after in-socket full-context retry (src/providers/codex/mod.rs):full_context_retry_attemptedshort-circuit fromis_continuation_retry_errortois_missing_previous_response_error, allowing transient WebSocket drops (websocket_missing_terminal, keepalive failures, start timeouts) after a full-context retry to use the normal retry budget while still failing fast on repeated missing-origin errors.Observability and downstream disconnect responsiveness (
src/providers/codex/websocket.rs):Message::Close(CloseFrame)code and reason inmissing_terminal_errorwhile preserving the existing prefix anddetail.guard.send(Message::Text(...))againsttx.closed()instart_codex_websocket_eventsso downstream disconnects immediately drop the socket lock, evict the pool entry, and close the upstream WebSocket.Verification
cargo fmt --all -- --check(passed)cargo clippy --locked --offline --all-targets -- -D warnings(passed, 0 warnings)cargo test --locked --offline(all 985 unit tests and all integration test targets includingtests/codex_websocket_proxy.rspassed)