fix(proxy):-restore-compaction-after-ChatGPT-retired-the-responses-compact-endpoint - #1715
Open
WangErgouaaaa wants to merge 2 commits into
Open
fix(proxy):-restore-compaction-after-ChatGPT-retired-the-responses-compact-endpoint#1715WangErgouaaaa wants to merge 2 commits into
WangErgouaaaa wants to merge 2 commits into
Conversation
ChatGPT retired /backend-api/codex/responses/compact on 2026-08-12; compaction is now served as a streamed plain /codex/responses request. - forward compact upstream to /codex/responses with stream=true - require explicit store=false (plain endpoint rejects absent store) - fold the upstream SSE stream back into the legacy response.compact shape Co-Authored-By: Claude <noreply@anthropic.com>
The plain responses endpoint only recognises compaction through a terminal compaction_trigger input item, which the API layer strips before the compact service - restore it for the upstream call. Also, streamed responses carry output items in response.output_item.done events while response.completed echoes an empty output array, so collect items by output index when folding the SSE stream back into the response.compact shape. Co-Authored-By: Claude <noreply@anthropic.com>
Collaborator
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
ChatGPT retired the dedicated compact endpoint
/backend-api/codex/responses/compacton 2026-08-12 18:44 UTC. Every compaction request through codex-lb has 404'd since then, regardless of client version or account — compaction is fully broken on the current release.This PR restores compaction by serving it through the plain
/codex/responsesendpoint with the current v2 protocol:fix(proxy): serve compaction via plain responses endpoint— route compact requests to/codex/responses, forcestream: true, setstore: falseexplicitly (the plain endpoint rejects requests without it with400 Store must be set to false), and re-append the terminalcompaction_triggerinput item that the API layer strips before the compact service.fix(proxy): restore compaction trigger and collect streamed output items— the upstream compaction result is delivered via SSEresponse.output_item.doneevents (theresponse.completedpayload has an emptyoutputarray). Fold those events back into the legacyresponse.compactpayload, preservingencrypted_content, so the API layer's compaction validation passes (otherwise502 Compact response did not include a compaction output item).Protocol notes
POST /codex/responses+stream: true+store: false+ terminal{"type":"compaction_trigger"}input item +x-codex-turn-metadata: {"request_kind":"compaction"}header.{"id":"cmp_...","type":"compaction","encrypted_content":"..."}insideresponse.output_item.doneevents, ordered byoutput_index.compact_remote_v2already speaks this protocol.Testing
compaction success.