Repository navigation
fix(openai): bound ChatGPT OAuth token error response reads - #99609
mushuiyu886 wants to merge 1 commit into
Conversation
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Close as superseded: the patch is a plausible narrow fix for OpenAI ChatGPT OAuth non-OK token diagnostics, but #98113 is open, clean, proof-positive, maintainer-validated, and covers the same token response boundary more completely. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Canonical path: Close this duplicate branch and continue review or landing on #98113 as the canonical OpenAI Codex OAuth response-boundary fix. So I’m closing this here and keeping the remaining discussion on #98113. Review detailsBest possible solution: Close this duplicate branch and continue review or landing on #98113 as the canonical OpenAI Codex OAuth response-boundary fix. Do we have a high-confidence way to reproduce the issue? Yes. Current main source shows Is this the best way to solve the issue? No as a landing path. The patch is a plausible narrow mitigation, but the best current solution is the open canonical PR because it covers the same first-read boundary plus downstream JSON and error reads. Security review: Security review cleared: The diff hardens an existing OAuth token error response path and adds no dependency, workflow, credential, package, or supply-chain surface. AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model internal, reasoning high; reviewed against 43a7fd383997. |
|
🦞✅ Reason: structured ClawSweeper close marker: close-required (sha=2aaa9d6ffeed9c453515802c785fac47ec567b2d) Closed:
|
Summary
What Problem This Solves
OpenAI ChatGPT OAuth token exchange and refresh previously materialized every token response with
response.arrayBuffer()before checkingresponse.ok, then read non-OK diagnostics again withresponse.text(). That made the auth-provider failure path buffer external error bodies before OpenClaw could report a bounded diagnostic.User Impact
Users who hit ChatGPT OAuth token exchange or refresh failures still get the OpenAI status and diagnostic text, but OpenClaw no longer needs to materialize an unbounded token error body first.
Origin / follow-up
Follows #98496.
readResponseTextLimitedat provider boundaries and retaining targeted tests for oversized diagnostic bodies.Competition / linked PR analysis
No linked issue is being closed. I searched open PRs for this OpenAI ChatGPT OAuth token error-body target and found no existing open PR covering the same follow-up. The diff is limited to
extensions/openai/openai-chatgpt-oauth-flow.runtime.tsand its focused runtime test file.Real behavior proof
2aaa9d6ffeed9c453515802c785fac47ec567b2d, using OpenClawfetchWithSsrFGuardwith trusted environment proxy mode to reachhttps://auth.openai.com/oauth/token, then reading the real non-OK response withreadResponseTextLimitedat the 8 KiB token diagnostic budget.Review findings addressed
N/A — new follow-up PR, no review findings yet.
Regression Test Plan
extensions/openai/openai-chatgpt-oauth-flow.runtime.test.tsarrayBuffer()materialization, avoidresponse.text(), preserve release handling, and return the 8 KiB bounded failure message.postTokenFormwithout touching callback-server login flow, PKCE, token success parsing, or account identity extraction.Merge risk
Risk / Compatibility
Low risk. Successful token responses still materialize and parse as before. Only non-OK token diagnostics are capped before constructing the failure response, so callers keep the same status-aware failure shape with bounded text.
What was not changed
Root Cause
postTokenForm, materialized every OpenAI token response withresponse.arrayBuffer()before the exchange/refresh code checkedresponse.ok, and the failure branches then read diagnostic text withresponse.text().response.okand routes non-OK provider diagnostics throughreadResponseTextLimitedat the provider boundary before the failure response exists, so the unbounded buffer is removed at its source rather than trimmed later.extensions/openai/openai-chatgpt-oauth-flow.runtime.tsowns ChatGPT OAuth token exchange and refresh; the change happens before token result classification, credential construction, and account identity extraction, so diagnostic body size is bounded at the external provider boundary.