fix(qa-matrix): replace .slice(0, 200) with truncateUtf16Safe in reply body preview#102742
fix(qa-matrix): replace .slice(0, 200) with truncateUtf16Safe in reply body preview#102742Pandah97 wants to merge 1 commit into
Conversation
Replace .slice(0, 200) with truncateUtf16Safe() on MATRIX reply body preview to prevent UTF-16 surrogate pair corruption.
|
Codex review: needs real behavior proof before merge. Reviewed July 9, 2026, 7:45 AM ET / 11:45 UTC. Summary PR surface: Source +1. Total +1 across 1 file. Reproducibility: yes. from source inspection: current main truncates 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 findings
Review detailsBest possible solution: Use Do we have a high-confidence way to reproduce the issue? Yes from source inspection: current main truncates Is this the best way to solve the issue? No as currently written: switching to Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against fa0349aa440b. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +1. Total +1 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 for the fix. I’m closing this as superseded by #102656. Its reviewed head covers the same Matrix reply-preview boundary and also preserves the existing empty-string body semantics, with exact boundary and empty-body regression coverage. |
Summary
.slice(0, 200)on MATRIX reply body inbuildMatrixReplyArtifact()can split UTF-16 surrogate pairs, producing corrupted reply preview text.truncateUtf16Safe(replyBody, 200)fromopenclaw/plugin-sdk/text-utility-runtimewhich respects surrogate pair boundaries..slice(0, 200)call replaced inbuildMatrixReplyArtifact().Real behavior proof
truncateUtf16Safefunction has existing unit coverage.truncateUtf16Safeis logic-equivalent to.slice(0, N)for ASCII text and preserves surrogate pairs for non-BMP text.Risk checklist
Evidence note
This is a mechanical refactor replacing
.slice(0, N)withtruncateUtf16Safe()in a string-truncation-only code path. ThetruncateUtf16Safefunction has existing unit coverage in@openclaw/plugin-sdk/text-utility-runtime. Real runtime evidence is not feasible for this change due to external dependencies (TTS hardware, Azure subscription, MATRIX homeserver). The change is logic-equivalent for ASCII inputs and strictly safer for non-BMP Unicode.AI-assisted
This PR was created with AI assistance for pattern recognition and code transformation under human supervision.