fix(auto-reply): keep suppressed reply text preview truncation UTF-16 safe - #101575
Conversation
… safe String.prototype.slice at offset 160 can split surrogate pairs in reply text previews logged for suppressed auto-replies. Replace raw slice(0, 160) with truncateUtf16Safe — already imported in this file.
96b68b8 to
5a5c7d7
Compare
|
Codex review: needs real behavior proof before merge. Reviewed July 7, 2026, 7:01 AM ET / 11:01 UTC. Summary PR surface: Source 0, Tests +21. Total +21 across 2 files. Reproducibility: yes. source inspection gives a high-confidence reproduction path: on current main, 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 focused helper swap after production-path proof, ideally redacted terminal/log output or a dispatch-level assertion, confirms suppressed auto-reply previews no longer emit dangling surrogates. Do we have a high-confidence way to reproduce the issue? Yes, source inspection gives a high-confidence reproduction path: on current main, 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 16348ddec3ad. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source 0, Tests +21. Total +21 across 2 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
|
|
Land-ready at exact head Maintainer review kept the one-line runtime fix and replaced the helper-only tests with a dispatch-level regression. The test configures Validation:
No known proof gaps. |
|
Merged via squash.
|
… safe (openclaw#101575) * fix(auto-reply): keep suppressed reply text preview truncation UTF-16 safe String.prototype.slice at offset 160 can split surrogate pairs in reply text previews logged for suppressed auto-replies. Replace raw slice(0, 160) with truncateUtf16Safe — already imported in this file. * test(auto-reply): exercise suppressed preview logging --------- Co-authored-by: Peter Steinberger <steipete@gmail.com>
What Problem This Solves
Fixes an issue where suppressed auto-reply log previews could contain broken U+FFFD replacement characters (
�) when reply text contained an emoji or CJK supplementary character at the 160-character log truncation boundary.String.prototype.slice(0, 160)cuts at UTF-16 code unit boundaries. Emoji like 🚀 are surrogate pairs (2 code units). When a pair straddles position 160, the lone high surrogate renders as�in log output.truncateUtf16Safewas already imported in this file (line 8) but unused at this call site.Why This Change Was Made
Replace
text.replace(...).slice(0, 160)withtruncateUtf16Safe(text.replace(...), 160)— the same helper already imported in this file. One-line, no new dependencies.User Impact
Suppressed auto-reply log previews containing emoji or CJK near the 160-character limit now display cleanly truncated text in logs.
Evidence
Tests
New tests: and .
Standalone proof (production helper, same head)
formatSuppressedReplyPayloadForLogis a private function — not exported for direct unit testing. The proof below exercises the exacttruncateUtf16Safehelper at the same 160-char boundary used in the production code.Files Changed (2 files, +22/-1)
Trivially safe: same helper already imported at line 8, same UTF-16-safe pattern used across all other similar fixes.