Skip to content

Fix ChatGPT subscription summaries rejected as Bad Request - #7147

Merged
ComputelessComputer merged 1 commit into
mainfrom
cursor/fix-chatgpt-subscription-codex-request-1154
Aug 29, 2026
Merged

Fix ChatGPT subscription summaries rejected as Bad Request#7147
ComputelessComputer merged 1 commit into
mainfrom
cursor/fix-chatgpt-subscription-codex-request-1154

Conversation

@ComputelessComputer

@ComputelessComputer ComputelessComputer commented Aug 29, 2026

Copy link
Copy Markdown
Collaborator

Summary

Problem: Summary generation fails with a generic Bad Request when Intelligence is a connected ChatGPT Plus/Pro subscription. The enhancer always sends maxOutputTokens: 8192, and @ai-sdk/openai forwards that as max_output_tokens with store: true — both rejected by chatgpt.com/backend-api/codex/responses.

Fix: Match OpenCode's ChatGPT subscription / Codex request contract on the fetch rewrite path:

  • Force store: false and stream: true
  • Drop unsupported max_output_tokens
  • Send session_id plus compute-residency when the token carries it
  • Surface Codex { "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 normal max_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 Codex store/stream/max_output_tokens contract there would be wrong.

Verification

  • pnpm exec dprint fmt / dprint check on the changed files
  • pnpm exec oxlint --quiet --format=github apps/desktop/src/settings/ai/llm/
  • pnpm -F desktop typecheck
  • pnpm -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.ts

Manual 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.

Open in Web Open in Cursor 

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>
@netlify

netlify Bot commented Aug 29, 2026

Copy link
Copy Markdown

Deploy Preview for anarlog canceled.

Name Link
🔨 Latest commit 5e8e4af
🔍 Latest deploy log https://app.netlify.com/projects/anarlog/deploys/6a9235cf4adcfb00086c2013

@cla-assistant

cla-assistant Bot commented Aug 29, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@ComputelessComputer
ComputelessComputer marked this pull request as ready for review August 29, 2026 01:33
@ComputelessComputer
ComputelessComputer merged commit 2458050 into main Aug 29, 2026
21 of 22 checks passed
@ComputelessComputer
ComputelessComputer deleted the cursor/fix-chatgpt-subscription-codex-request-1154 branch August 29, 2026 01:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants