fix: preserve Codex Responses headers#2494
Closed
cyhhao wants to merge 4 commits into
Closed
Conversation
Contributor
|
All contributors have signed the CLA. ✅ |
Contributor
Author
|
I have read the CLA Document and I hereby sign the CLA |
Contributor
Author
|
recheck |
|
Hi, I’m also hitting this GPT-5.5 remote compact failure. I noticed #2494 seems related to preserving Codex Responses headers / remote_compaction_v2, but it was closed without being merged. Was that PR superseded by another fix, or was there a blocker with that approach? |
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.
What
X-Codex-Beta-Features,Version, turn metadata/state, window id, parent thread id, and installation id.x-codex-beta-features: remote_compaction_v2when a Codexcontext_compactionitem is present but an intermediate client/proxy omitted the header.X-Codex-Turn-Stateresponse headers back to Codex clients so later requests in the same turn can replay the sticky-routing token.context_compactionSSE output items pass through unchanged.Why
Recent Codex remote compaction v2 requests send
context_compactionitems through/v1/responsesand advertise the protocol withx-codex-beta-features: remote_compaction_v2. Official Codex also sends aversionheader on Responses requests. If sub2api filters these headers, ChatGPT Codex backend can validate the request as a normal/older Responses payload and rejectcontext_compactionas an invalid item type.The v2 flow is streaming. Codex also captures
x-codex-turn-statefrom the stream response headers and replays it on subsequent requests in the same turn. Preserving that response header keeps the v2 streaming contract intact.Related issues
Some of the older reports also mention model mapping, fixed Codex version headers, or timeout/context-canceled behavior, so this PR intentionally references them as related rather than claiming to close all of them.
Test
go test ./internal/servicego test ./internal/util/responseheadersRisk
Low. This extends existing Codex-specific allowlists and preserves the upstream SSE body shape; it does not rewrite request or response bodies.