fix(provider-usage): bound usage JSON response reads#97659
Conversation
|
Codex review: needs maintainer review before merge. Reviewed June 29, 2026, 12:56 AM ET / 04:56 UTC. Summary PR surface: Source +5, Tests +73. Total +78 across 5 files. Reproducibility: yes. Current main and v2026.6.10 still use direct response.json()/res.json() in the shared provider usage and MiniMax success paths, and the bounded-reader contract shows why oversized streams are currently unbounded there. Review metrics: 1 noteworthy metric.
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 one consolidated provider-usage hardening PR that uses the shared bounded reader for all usage JSON success/error bodies, keeps focused oversized-stream regression tests, and treats the 16 MiB cap as an accepted provider usage contract. Do we have a high-confidence way to reproduce the issue? Yes. Current main and v2026.6.10 still use direct response.json()/res.json() in the shared provider usage and MiniMax success paths, and the bounded-reader contract shows why oversized streams are currently unbounded there. Is this the best way to solve the issue? Mostly yes. The shared helper and MiniMax direct success read are the right fix layer, but the best merge path is to reconcile this fuller branch with the older shared-helper PR and have maintainers accept or tune the 16 MiB cap. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 75db48a17522. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +5, Tests +73. Total +78 across 5 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
|
Replace unbounded response.json() with readProviderJsonResponse in readUsageJson to cap provider usage API response bodies at 16 MiB, preventing unbounded buffering from all seven providers (claude, gemini, codex, z.ai, deepseek, minimax, and openai-compatible). Co-Authored-By: Claude <[email protected]>
afd614a to
39e1fc2
Compare
Replacement for #97610 because the fork rejected maintainer pushes while the submitted diff was incomplete.
Preserves the original shared usage-reader change and adds the missing bounded reads for MiniMax success responses and Claude usage error bodies.
Validation: