Fix ChatGPT subscription summaries rejected as Bad Request - #7147
Merged
ComputelessComputer merged 1 commit intoAug 29, 2026
Merged
Conversation
Rewrite Codex Responses requests to match OpenCode's ChatGPT subscription contract: force store=false and stream=true, drop max_output_tokens, and send session/residency headers. Co-authored-by: John Jeong <ComputelessComputer@users.noreply.github.com>
✅ Deploy Preview for anarlog canceled.
|
|
|
ComputelessComputer
marked this pull request as ready for review
August 29, 2026 01:33
ComputelessComputer
deleted the
cursor/fix-chatgpt-subscription-codex-request-1154
branch
August 29, 2026 01:47
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
Problem: Summary generation fails with a generic
Bad Requestwhen Intelligence is a connected ChatGPT Plus/Pro subscription. The enhancer always sendsmaxOutputTokens: 8192, and@ai-sdk/openaiforwards that asmax_output_tokenswithstore: true— both rejected bychatgpt.com/backend-api/codex/responses.Fix: Match OpenCode's ChatGPT subscription / Codex request contract on the fetch rewrite path:
store: falseandstream: truemax_output_tokenssession_idplus compute-residency when the token carries it{ "detail": "..." }payloads in the settings health check instead of just "Bad Request"Other subscriptions: This rewrite is ChatGPT-only. Claude, Grok, Copilot, and Kimi talk to their public APIs (
api.anthropic.com,api.x.ai,api.githubcopilot.com,api.kimi.com/coding), which accept the SDK's normalmax_tokens/ Messages bodies. OpenCode's Claude/Grok/Copilot plugins only swap auth headers for those providers — they do not rewrite the request body. Applying the Codexstore/stream/max_output_tokenscontract there would be wrong.Verification
pnpm exec dprint fmt/dprint checkon the changed filespnpm exec oxlint --quiet --format=github apps/desktop/src/settings/ai/llm/pnpm -F desktop typecheckpnpm -F desktop test src/settings/ai/llm/subscriptions/oauth.test.ts src/settings/ai/llm/subscriptions/fetch.test.ts src/settings/ai/llm/health.test.tsManual ChatGPT Plus/Pro summary generation was not run here (needs a live subscription). After merge, connect ChatGPT in Settings → Intelligence and retry Enhance on a note.