fix(subagent): keep emoji / surrogate pairs intact during subagent announce log truncation#101615
fix(subagent): keep emoji / surrogate pairs intact during subagent announce log truncation#101615maweibin wants to merge 0 commit into
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 7, 2026, 8:00 AM ET / 12:00 UTC. Summary PR surface: Source +2. Total +2 across 1 file. Reproducibility: yes. source-reproducible. Current main slices the normalized delivery error at a UTF-16 code-unit boundary, and the PR expression was also checked with a read-only Node command showing the new false-ellipsis behavior for emoji-heavy input. 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:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Use the existing UTF-16-safe truncation helper for this log formatter, add focused coverage for both the surrogate-boundary case and the no-false-ellipsis case, then provide redacted terminal or log proof from the patched path. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible. Current main slices the normalized delivery error at a UTF-16 code-unit boundary, and the PR expression was also checked with a read-only Node command showing the new false-ellipsis behavior for emoji-heavy input. Is this the best way to solve the issue? No. The correct repair should preserve the existing length semantics with Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 2ba622ca3019. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +2. Total +2 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
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
65a6c32 to
775ef96
Compare
What Problem This Solves
the subagent announce give-up log fieldinsrc/agents/subagent-registry-helpers.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 1999-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.