fix(core): keep backend truncation UTF-16 safe#100244
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 5, 2026, 8:33 AM ET / 12:33 UTC. Summary PR surface: Source +3, Tests +63. Total +66 across 4 files. Reproducibility: yes. Source inspection shows current main uses raw UTF-16 code-unit slicing at the ACP and active-memory boundaries, and the PR's regression cases target those exact split-surrogate positions. Review metrics: none identified. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land this narrowed PR after routine exact-head CI and maintainer review, then treat the active-memory-only related PR as superseded if this broader backend fix merges. Do we have a high-confidence way to reproduce the issue? Yes. Source inspection shows current main uses raw UTF-16 code-unit slicing at the ACP and active-memory boundaries, and the PR's regression cases target those exact split-surrogate positions. Is this the best way to solve the issue? Yes. Reusing the existing UTF-16-safe helper is the narrow maintainable fix here, and the PR correctly leaves broader chat-display and native-approval surfaces out after narrowing. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against fd2e4da00651. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +3, Tests +63. Total +66 across 4 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
Review history (4 earlier review cycles)
|
7ddd1aa to
dc114e4
Compare
8465086 to
0cb26b7
Compare
bed8948 to
e1bb413
Compare
|
Maintainer repair is land-ready.
The earlier |
e1bb413 to
e883141
Compare
…lay, and native hook relay
Co-authored-by: xialonglee <[email protected]> Co-authored-by: ZengWen-DT <[email protected]>
e883141 to
00266be
Compare
|
Merged via squash.
|
* fix(core): use UTF-16-safe truncation for chat display, ACP stream relay, and native hook relay * fix(core): narrow UTF-16 truncation repair Co-authored-by: xialonglee <[email protected]> Co-authored-by: ZengWen-DT <[email protected]> --------- Co-authored-by: Vincent Koc <[email protected]> Co-authored-by: ZengWen-DT <[email protected]>
What Problem This Solves
Backend text truncation could split UTF-16 surrogate pairs in two places:
The malformed halves can surface as replacement characters in progress text or injected memory context.
Why This Change Was Made
truncateUtf16Safefor ACP preview and active-memory summary cutoffs.sliceUtf16Safewhen retaining the tail of a long ACP delta.The original chat-display and native approval changes were removed. This PR is intentionally limited to non-UI, non-approval backend paths.
This also folds the valid active-memory fix from #98711, preserving contributor credit.
User Impact
Emoji and other supplementary-plane characters remain valid when backend relay or memory text is truncated. Limits, ellipsis behavior, routing, and configuration remain unchanged.
Evidence
00266be5318b07012f6b4c17b338243ef9687f88tbx_01kws0qtfp8bxaxfy381gtqt9zcheck:test-types: passed;check:changed; exact-head CI covers the final rebase.git diff --checkand four-fileoxfmt --check: passed.0xD83D,0xDE00, and0xD83Cat the three repaired boundaries.Exact-head hosted CI: https://github.com/openclaw/openclaw/actions/runs/28741038571