fix(infra): enforce maxBytes in body-less HTTP error snippet path#99340
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 2, 2026, 11:30 PM ET / 03:30 UTC. Summary PR surface: Source +9, Tests +99. Total +108 across 2 files. Reproducibility: yes. source-reproducible: current main’s fallback path ignores Review metrics: none identified. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land this focused helper fix after CI attribution, or intentionally supersede it with the broader boundary-safety PR if maintainers choose that path. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible: current main’s fallback path ignores Is this the best way to solve the issue? Yes for the returned diagnostic snippet: the shared helper is the right narrow owner because both MiniMax VLM and native PDF error paths call it. The remaining limitation is that a non-stream fallback cannot avoid AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 2e049f509fad. Label changesLabel justifications:
Evidence reviewedPR surface: Source +9, Tests +99. Total +108 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
|
16f6145 to
7bf7e25
Compare
Co-Authored-By: Claude Opus 4.7 <[email protected]>
7bf7e25 to
f7ed084
Compare
…enclaw#99340) * fix(infra): enforce maxBytes in body-less HTTP error snippet path * chore: rebase to trigger CI after boundaries check fix Co-Authored-By: Claude Opus 4.7 <[email protected]> --------- Co-authored-by: Claude Opus 4.7 <[email protected]>
…enclaw#99340) * fix(infra): enforce maxBytes in body-less HTTP error snippet path * chore: rebase to trigger CI after boundaries check fix Co-Authored-By: Claude Opus 4.7 <[email protected]> --------- Co-authored-by: Claude Opus 4.7 <[email protected]>
What Problem This Solves
Fixes an issue where
readResponseBodySnippetwould bypass themaxByteslimit when reading provider error bodies from responses whosebodyis null or lacks agetReaderfunction. A malformed response entering this fallback path would buffer the entire body viaresponse.text()before applying themaxCharstruncation — themaxBytesguard was never enforced. The stream path (normal ReadableStream responses) already enforcedmaxBytescorrectly.Why This Change Was Made
The body-less path now encodes the text and truncates at
maxBytesbefore decoding and applyingmaxChars, matching the existing stream path contract. The truncated byte buffer is decoded with{ stream: true }so an incomplete multi-byte UTF-8 sequence at the cut point is dropped rather than rendered as a replacement character.User Impact
Provider error snippets (used in MiniMax VLM and native PDF provider error messages) now respect the configured byte budget in all response shapes. No API or config surface changes.
Evidence
Real behavior proof (fix). The body-less path now enforces
maxBytes:Negative control (pre-fix main). Same proof script against
origin/main—maxBytesis ignored, full text returned:Focused tests:
Caller regression:
Format:
oxfmt --checkclean on both changed files.