Repository navigation
fix(media): preserve size errors for fractional byte limits - #136402
Conversation
Track observed response bytes once and derive the retained whole-byte length. Keep timeout projection, cancellation, and diagnostics unchanged. Fixes #136397 Related: #135418 Co-authored-by: ben.li <[email protected]>
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed September 2, 2026, 1:18 PM ET / 17:18 UTC. ClawSweeper reviewWhat this changesThe PR makes the shared HTTP response reader retain whole-byte prefixes for fractional limits while preserving overflow errors, and normalizes an equivalent Chromium CSS serialization in a browser test. Merge readinessKeep open. Current main still passes a fractional retained-byte count to Priority: P2 Review scores
Verification
How this fits togetherMedia downloads and diagnostic captures feed streamed HTTP responses into a shared bounded reader, which either returns retained bytes or reports an overflow to its caller. The browser test separately compares computed CSS values across Chromium serialization variants. flowchart LR
A[Chunked HTTP response] --> B[Bounded response reader]
B --> C{Limit exceeded?}
C -->|No| D[Complete buffer]
C -->|Yes| E[Whole-byte prefix]
E --> F[Size-limit error]
G[Computed CSS value] --> H[Browser style probe]
H --> I[Portable assertion]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -10, Tests +27. Total +17 across 3 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the shared reader as the sole fractional-byte repair point, retain the focused regressions, and land after the exact head receives normal maintainer and CI validation. Do we have a high-confidence way to reproduce the issue? Yes, from source: a fractional Is this the best way to solve the issue? Yes. Repairing the shared response-reader allocation calculation preserves the caller's AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 284805b371ec. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Merged via squash.
|
…#136402) * fix(media): preserve size errors for fractional byte limits Track observed response bytes once and derive the retained whole-byte length. Keep timeout projection, cancellation, and diagnostics unchanged. Fixes openclaw#136397 Related: openclaw#135418 Co-authored-by: ben.li <[email protected]> * test(ui): compare equivalent circular corner serialization --------- Co-authored-by: ben.li <[email protected]>
Closes #136397
Related: #135418
What Problem This Solves
Fixes an issue where users downloading media under a decimal MiB limit receive a generic fetch failure instead of the size-limit error. Bounded diagnostic text reads can also throw instead of returning their truncated prefix.
Why This Change Was Made
The shared HTTP response reader tracked a sliced chunk using a fractional budget remainder, then passed that fractional length to
Buffer.concat. It now counts observed bytes once and derives the retained whole-byte length. The redundant counter, single-use validation wrapper, and success-path error factory are removed; timeout forwarding, cancellation, and configured limits retain their existing behavior.This is a maintainer-owned replacement approach for the fractional-limit problem investigated by @ly85206559 in #135418. Repairing the reader covers all valid fractional byte-budget callers without adding channel fallback policy or changing positive sub-byte limits. Contributor credit is preserved in the commit.
User Impact
Oversized chunked downloads are correctly classified as size-limit failures. Downloads within the limit still succeed, and diagnostic prefixes return only complete retained bytes. No configuration or migration is required.
Evidence
0.1MiB budget resolves to104857.6bytes. A104857-byte chunked response succeeds before and after; a104858-byte response changes fromfetch_failed/RangeErrortomax_bytes.node scripts/check-changed.mjspasses, including production and test type checks, lint, boundary checks, and runtime guards.e3a8c87f40058206d36babd6233b22b613ed112d; production is unchanged from the original reviewed head.CI follow-up
The hosted retry exposed two unrelated corner-style assertions that distinguished
roundfrom the equivalent computed valuesuperellipse(1). The CSS Borders draft defines them as the same shape. The existing browser probe now normalizes that exact alias; distinct curvature, radii, and root-token expectations are unchanged. Local Chromium reports both assignments asround, while the retained hosted log reportssuperellipse(1).All three corner browser cases pass locally after the correction; formatting and an independent P2 supplement are clean. The new head still requires hosted CI. This is test portability maintenance, with no additional product bug claimed.