Repository navigation
fix(openai): bound OAuth token response read at first body read in postTokenForm to prevent OOM - #97754
fix(openai): bound OAuth token response read at first body read in postTokenForm to prevent OOM#97754cxbAsDev wants to merge 1 commit into
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed June 29, 2026, 10:33 AM ET / 14:33 UTC. Summary PR surface: Source +23, Tests +59. Total +82 across 2 files. Reproducibility: yes. from source inspection: current main and Review metrics: 1 noteworthy metric.
Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land the narrow first-read cap after changed-path real behavior proof covers normal and oversized OAuth exchange and refresh, while keeping broader OpenAI response-size sweeps separate unless maintainers choose one unified landing path. Do we have a high-confidence way to reproduce the issue? Yes from source inspection: current main and Is this the best way to solve the issue? Yes on code shape: applying AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against be94853de0d0. Label changesLabel justifications:
Evidence reviewedPR surface: Source +23, Tests +59. Total +82 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
What Problem This Solves
The original fix (#97716) applied bounded response readers downstream in
exchangeAuthorizationCodeandrefreshAccessToken, but those operate on aResponsealready re-wrapped afterpostTokenFormconsumed the entire body withawait response.arrayBuffer(). The actual OOM vector was the unbounded first read insidepostTokenForm.This PR moves the 16 MiB bounded read (
readResponseWithLimit) intopostTokenForm— before the body is buffered — so oversized OAuth token responses are cancelled mid-stream rather than fully buffered. Downstream bounded readers are retained for defense-in-depth.Evidence
Environment: Linux, Node 22, OpenClaw main @ 0ce10d7
Terminal output — all 12 tests pass, including 2 oversized-response regression tests:
The oversized tests create 18 MiB ReadableStream responses (cap is 16 MiB) and verify the bounded reader in
postTokenFormcancels the stream and the error propagates throughexchangeAuthorizationCode/refreshAccessTokenas a formatted token failure.Risk
Low. The 16 MiB cap matches the codebase convention. The cap is applied at the first body read (inside
postTokenForm), and downstream bounded readers provide defense-in-depth on the re-wrapped response.🤖 Generated with Claude Code