fix(web-fetch): keep spill content truncation UTF-16 safe#101312
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 7, 2026, 1:27 AM ET / 05:27 UTC. Summary PR surface: Source +2, Tests +32. Total +34 across 2 files. Reproducibility: yes. from source inspection: current main raw-slices spill content at WEB_FETCH_SPILL_MAX_CHARS, so an emoji crossing that UTF-16 boundary can leave a dangling surrogate in the recoverable spill file. I did not execute tests in this read-only review. Review metrics: none identified. Stored data model 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. Next step before merge
Security Review detailsBest possible solution: Land this narrow spill-path fix after exact-head CI and maintainer review; keep broader bounded-output UTF-16 hardening tracked through the already-merged related PR. Do we have a high-confidence way to reproduce the issue? Yes from source inspection: current main raw-slices spill content at WEB_FETCH_SPILL_MAX_CHARS, so an emoji crossing that UTF-16 boundary can leave a dangling surrogate in the recoverable spill file. I did not execute tests in this read-only review. Is this the best way to solve the issue? Yes: applying truncateUtf16Safe at spillWebFetchContent is the narrow owner-boundary fix because model-visible truncateText is already hardened separately and the spill-file cap remains a distinct path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 53580e13a483. Label changesLabel justifications:
Evidence reviewedPR surface: Source +2, Tests +32. Total +34 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
|
328bb56 to
8087092
Compare
|
@clawsweeper re-review I addressed the spill footer count finding and refreshed the real behavior proof with a standalone |
|
🦞🧹 I asked ClawSweeper to review this item again. |
8087092 to
9152389
Compare
|
@clawsweeper re-review Current head/proof body was refreshed after the last rebase; please re-review the latest head. |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Maintainer review complete on exact head
Ready to land. |
|
Merged via squash.
|
…01312) * Fix UTF-16-safe web fetch spill truncation * fix(web-fetch): report actual spill character count
…01312) * Fix UTF-16-safe web fetch spill truncation * fix(web-fetch): report actual spill character count
Summary
WEB_FETCH_SPILL_MAX_CHARS.Linked context
Real behavior proof (required for external PRs)
WEB_FETCH_SPILL_MAX_CHARSinside an emoji/surrogate pair.9152389df4c611962d53f9d81937360026a35539.node scripts/run-vitest.mjs src/agents/tools/web-tools.fetch.test.tsnode --import tsx --input-type=moduleinvocation of the actualcreateWebFetchTool().executepath with a deterministic text response payload.Standalone tool-execution transcript from the same head, not a Vitest assertion:
WEB_FETCH_SPILL_MAX_CHARS - 1characters for the surrogate-boundary case, the footer saysSpilled first 1999999 chars., and the spilled file has no dangling surrogate.createWebFetchTool().executepath, spill writer, footer formatter, and spill-file readback were exercised.Tests and validation
node scripts/run-vitest.mjs src/agents/tools/web-tools.fetch.test.tsnode --import tsx --input-type=moduletool-execution transcript shown above.Risk checklist
Did user-visible behavior change? (
Yes/No)Yes. Malformed truncated spill text is now avoided, and the footer reports the actual safe-sliced character count.
Did config, environment, or migration behavior change? (
Yes/No)No.
Did security, auth, secrets, network, or tool execution behavior change? (
Yes/No)No.
What is the highest-risk area?
web_fetch private spill-file content formatting.
How is that risk mitigated?
The patch is limited to the existing truncation boundary, uses the existing UTF-16 helper, preserves the existing cap behavior, and is covered by focused test plus standalone tool execution proof.
Current review state
What is the next action?
ClawSweeper re-review and maintainer review.
What is still waiting on author, maintainer, CI, or external proof?
Nothing is waiting on the author after this update; waiting on CI/ClawSweeper/maintainer review.
Which bot or reviewer comments were addressed?
Addressed ClawSweeper's footer-count finding and needs-proof feedback with a code fix, a focused regression assertion, and standalone web_fetch tool-execution proof from the current PR head.