Repository navigation
Conversation
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Close as superseded: the same root issue is now covered by #101270, which updates the shared helper and canonical Vitest coverage with positive proof, while this PR is conflicting and narrower. Canonical path: #101269 is still open and describes the same no-reader So I’m closing this here and keeping the remaining discussion on #101270 and #101269. Review detailsBest possible solution: Use #101270 as the landing path, or ask for one consolidated branch that changes both Do we have a high-confidence way to reproduce the issue? Yes. Source inspection gives a high-confidence path: pass a no-reader Is this the best way to solve the issue? No. The fail-closed direction is right, but this branch is not the best landing path because #101270 covers the shared helper and canonical tests with positive proof while this branch is conflicting and narrower. Security review: Security review cleared: No dependency, workflow, credential, permission, or supply-chain regression was found in this diff; the intended behavior reduces an availability risk. AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model internal, reasoning high; reviewed against 09977a9328bc. |
… fallback The non-streaming fallback called response.text() without any size bound, buffering the entire body before slicing to maxChars. Apply TextEncoder → subarray(maxBytes) → TextDecoder → strip U+FFFD artifacts → slice(maxChars) so the fallback path respects maxBytes like the streaming path already does. Trim trailing replacement characters so a subarray cut that lands mid-codepoint does not leak a bare U+FFFD into the snippet. Closes openclaw#101269 Co-Authored-By: Claude <[email protected]>
e86e1a8 to
3d2f218
Compare
…back Per ClawSweeper review: the previous fix still awaited response.text() before applying maxBytes, so a large non-streaming response body was still fully materialized in memory first. Replace the whole-body fallback with a fail-closed return of "" — when no body reader is available, return empty rather than risk OOM. Co-Authored-By: Claude <[email protected]>
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Closing: ClawSweeper judged this superseded by another PR covering the same root issue. Not worth maintaining a conflicting branch. |
What Problem This Solves
readResponseBodySnippetinsrc/infra/http-error-body.tshas a non-streaming fallback path that previously calledresponse.text()which would buffer the entire body beforemaxBytescould be applied — creating an OOM risk for large error responses on non-streaming transports.Why This Change Was Made
Replace the whole-body fallback with a fail-closed approach: when the response body has no
getReader(non-streaming or mocked responses), return `` immediately instead of callingresponse.text(). The streaming path continues to enforce `maxBytes` via the bounded reader loop.This follows the ClawSweeper recommendation: "use a bounded stream source or fail closed before calling whole-body fallbacks."
Evidence
Real behavior proof (8/8 PASS)
Code change
The non-streaming fallback no longer calls
response.text():Issue
Fixes #101269
🤖 Generated with Claude Code