fix(agent-runner-execution): use truncateUtf16Safe for external run failure detail#102674
fix(agent-runner-execution): use truncateUtf16Safe for external run failure detail#102674zhangqueping wants to merge 1 commit into
Conversation
…ailure detail Replace raw UTF-16 slice in formatForwardedExternalRunFailureText with truncateUtf16Safe to prevent surrogate pair splitting. The module already imports truncateUtf16Safe for other truncation paths — this commit extends coverage to the remaining call site. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
|
Codex review: needs real behavior proof before merge. Reviewed July 9, 2026, 6:48 AM ET / 10:48 UTC. Summary PR surface: Source 0. Total 0 across 1 file. Reproducibility: yes. from source inspection: a verbose external failure detail over 900 UTF-16 code units can hit the raw slice boundary and leave a dangling surrogate. I did not run a live OpenClaw reproduction in this read-only review. Review metrics: none identified. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Merge the helper substitution after contributor-provided or maintainer-overridden real behavior proof shows the verbose external failure path keeps long emoji-containing details valid. Do we have a high-confidence way to reproduce the issue? Yes from source inspection: a verbose external failure detail over 900 UTF-16 code units can hit the raw slice boundary and leave a dangling surrogate. I did not run a live OpenClaw reproduction in this read-only review. Is this the best way to solve the issue? Yes for the code shape: replacing the implicated raw slice with the existing surrogate-safe helper is the narrowest maintainable fix. The remaining gap is proof, not a different implementation layer. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 5154fe08fa0b. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source 0. Total 0 across 1 file. 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
|
|
Thanks @zhangqueping. #102823 landed the same UTF-16-safe external-run failure-detail cap in |
What Problem This Solves
The external run failure detail formatter in
formatForwardedExternalRunFailureTexttruncates sanitized error messages with a raw UTF-16 code-unit slice. When an error message contains an emoji at the truncation boundary, the raw slice can produce an unpaired surrogate in the user-visible failure message.Why This Change Was Made
Replace
.slice(0, EXTERNAL_RUN_FAILURE_DETAIL_MAX_CHARS - 1)withtruncateUtf16Safe. The module already importstruncateUtf16Safefor other truncation paths — this extends coverage to the remaining call site. The existing limit, trim, and ellipsis behavior remain unchanged.User Impact
Agent failure messages shown to users remain valid Unicode when long error text contains emoji or other supplementary characters at the truncation boundary.
Evidence
npx vitest run src/auto-reply/reply/agent-runner-execution.test.ts— 1 file, 234 tests passed.Files Changed
src/auto-reply/reply/agent-runner-execution.ts.slice(0,N)withtruncateUtf16SafeinformatForwardedExternalRunFailureText.🤖 Generated with Claude Code