fix(zalouser): keep outbound message text truncation UTF-16 safe#101625
fix(zalouser): keep outbound message text truncation UTF-16 safe#101625lsr911 wants to merge 1 commit into
Conversation
Replace two raw .slice(0, 2000) calls with truncateUtf16Safe in Zalo media-message and plain-text send paths to prevent dangling surrogate pairs when the 2000-code-unit boundary splits an emoji or CJK supplementary character in outbound user-visible messages.
|
Codex review: needs real behavior proof before merge. Reviewed July 7, 2026, 8:19 AM ET / 12:19 UTC. Summary PR surface: Source +9. Total +9 across 1 file. Reproducibility: yes. from source inspection and a focused JS probe: Review metrics: 1 noteworthy metric.
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: Make Zalouser chunk range selection UTF-16-safe before slicing, keep the low-level truncation as a guard, and prove text/media sends with focused regression coverage plus redacted real send output. Do we have a high-confidence way to reproduce the issue? Yes from source inspection and a focused JS probe: Is this the best way to solve the issue? No; this is too low in the send stack because the unsafe boundary is selected upstream in 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 +9. Total +9 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
Review history (1 earlier review cycle)
|
|
Thanks @lsr911. The useful behavior from this PR was consolidated with the sibling UTF-16 boundary fixes into #101654 and landed on The landed fix uses the existing |
What Problem This Solves
The Zalouser plugin truncates outbound message text with
.slice(0, 2000)in two send paths — media messages and plain text messages. Zalo users in Vietnam commonly use emoji in messages. When the 2000-code-unit boundary lands mid-surrogate-pair, the dangling surrogate renders as U+FFFD in the message delivered to the Zalo recipient.This is the highest-impact fix in the UTF-16 series — unlike log/display truncation, these sites directly affect production user messages sent through the Zalo platform.
Why This Change Was Made
truncateUtf16Safeis already available viaopenclaw/plugin-sdk/text-utility-runtime— the same SDK module the file already imports from forsleep.Evidence
Branch prerun (commit cef6cca)
Files Changed
extensions/zalouser/src/zalo-js.tstruncateUtf16Safeimport; 2.slice(0, 2000)→truncateUtf16Safe(...)