fix(agents): keep chunkString and buildResumeMessage truncation UTF-16 safe#102085
Conversation
|
Codex review: needs changes before merge. Reviewed July 8, 2026, 8:58 PM ET / 00:58 UTC. Summary PR surface: Source +11, Tests +70. Total +81 across 4 files. Reproducibility: yes. source-reproducible. Current main uses raw code-unit slicing at both reported boundaries, and the current PR head still exposes a focused chunkString limit-1 data-loss case. Review metrics: none identified. Stored data model 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 findings
Review detailsBest possible solution: Keep the UTF-16 helper approach, but make chunkString preserve all input for every positive limit it accepts or explicitly reject/clamp unsupported tiny limits, with a limit-1 regression test. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible. Current main uses raw code-unit slicing at both reported boundaries, and the current PR head still exposes a focused chunkString limit-1 data-loss case. Is this the best way to solve the issue? No, not fully as submitted. Reusing the existing UTF-16 helpers is the right owner-boundary fix, but the empty-safe-slice branch should preserve the full code point or reject/clamp tiny limits instead of skipping input. Full review comments:
Overall correctness: patch is correct AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against eae3fc1a79dd. Label changesLabel justifications:
Evidence reviewedPR surface: Source +11, Tests +70. Total +81 across 4 files. View PR surface stats
Acceptance criteria:
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
|
52d7059 to
99b58c4
Compare
|
Land-ready proof for exact head
The reviewed implementation is the best bounded fix: one canonical chunk path, no data loss, no introduced surrogate halves, and owner-path regression coverage. |
|
Merged via squash.
|
…6 safe (openclaw#102085) * fix(agents): keep chunkString and buildResumeMessage truncation UTF-16 safe * fix: preserve code points in agent output chunks --------- Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
Two agent-owned prefix cuts could split UTF-16 surrogate pairs: streamed bash output chunking and truncated task text in orphan-recovery resume messages. The initial chunking fix also dropped a whole emoji when the configured limit was one UTF-16 unit.
Why This Change Was Made
chunkStringchoose a surrogate-safe boundary while always emitting at least one whole code point.User Impact
Agent output chunking no longer corrupts or loses emoji at transport boundaries. Restarted subagents receive valid Unicode task prefixes in synthetic resume messages.
Evidence
env CI=true corepack pnpm test src/agents/bash-tools.shared.test.ts src/agents/subagent-orphan-recovery.test.tsgit diff --checkAI-assisted: Yes