fix(tasks): keep emoji / surrogate pairs intact during terminal output truncation#101600
Conversation
…t truncation .slice() counts UTF-16 code units; use Array.from() to count full code points instead, preventing lone surrogates in task list output. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Codex review: needs real behavior proof before merge. Reviewed July 7, 2026, 7:50 AM ET / 11:50 UTC. Summary PR surface: Source -2, Tests +25. Total +23 across 2 files. Reproducibility: yes. from source inspection: current main's task table truncator can split a surrogate pair when task summary text crosses its column boundary. I did not run a live CLI repro, so this is source-reproducible rather than fully reproduced. 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: Land the helper-based task truncation fix after redacted real Do we have a high-confidence way to reproduce the issue? Yes from source inspection: current main's task table truncator can split a surrogate pair when task summary text crosses its column boundary. I did not run a live CLI repro, so this is source-reproducible rather than fully reproduced. Is this the best way to solve the issue? Yes: using the existing AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against bd7da9decd7e. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source -2, Tests +25. Total +23 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
|
|
Land-ready at exact head Maintainer review replaced code-point truncation with the canonical UTF-16-safe helper, preserving every existing task table width. Cleanup also removed the separate raw-slice edge branch, reducing production code, and added a regression that creates a completed task, runs Validation:
The PR body was corrected to describe the shared task-table surface and final implementation. No known proof gaps. |
|
Merged via squash.
|
…t truncation (openclaw#101600) * fix(tasks): keep emoji / surrogate pairs intact during terminal output truncation .slice() counts UTF-16 code units; use Array.from() to count full code points instead, preventing lone surrogates in task list output. Co-Authored-By: Claude Opus 4.8 <[email protected]> * fix(tasks): preserve terminal column width --------- Co-authored-by: Claude Opus 4.8 <[email protected]> Co-authored-by: Peter Steinberger <[email protected]>
…t truncation (openclaw#101600) * fix(tasks): keep emoji / surrogate pairs intact during terminal output truncation .slice() counts UTF-16 code units; use Array.from() to count full code points instead, preventing lone surrogates in task list output. Co-Authored-By: Claude Opus 4.8 <[email protected]> * fix(tasks): preserve terminal column width --------- Co-authored-by: Claude Opus 4.8 <[email protected]> Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
the task CLI table truncatorinsrc/commands/tasks.tstruncates text with.slice()which counts UTF-16 code units. When a surrogate-pair character (emoji) straddles the cut boundary,.slice()produces a lone surrogate (e.g.\ud83d) that renders as�in terminal output.This is user-visible: the truncated text comes from real user-facing output, so any content containing emoji near the 78-character boundary can hit this.
Why This Change Was Made
Replace
.slice()withtruncateUtf16Safe()from@openclaw/normalization-core/utf16-sliceso the truncation counts full code points instead of UTF-16 code units. This matches the already-merged PR #101517 (session-cost-usage) and the existingshortenTexthelper insrc/commands/text-format.ts:5.User Impact
Users will no longer see
�replacement characters in this output when emoji appear near truncation boundaries.Evidence
Real environment tested: local OpenClaw source checkout, Node v24.13.1, PR head.
Exact steps after this patch:
Evidence after fix:
Observed result after fix:
truncateUtf16Safepreserves full code points; no lone surrogate reaches output.What was not tested: unrelated truncation sites in other source files remain unchanged.
Regression Test Plan
AI-assisted.