fix(gateway): keep live chat assistant buffer tail truncation UTF-16 safe#102484
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 9, 2026, 3:30 AM ET / 07:30 UTC. Summary PR surface: Source +1, Tests +11. Total +12 across 2 files. Reproducibility: yes. Current main's raw negative slice can start the retained live chat tail with low surrogate Review metrics: none identified. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. 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: Merge the focused gateway fix after redacted real behavior proof is added for the current head, keeping Do we have a high-confidence way to reproduce the issue? Yes. Current main's raw negative slice can start the retained live chat tail with low surrogate Is this the best way to solve the issue? Yes for the code and test shape. Reusing the existing AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 9aa19fef2ff0. Label changesLabel justifications:
Evidence reviewedPR surface: Source +1, Tests +11. Total +12 across 2 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 (1 earlier review cycle)
|
|
Land-ready at exact head Review improvements:
Proof:
No known proof gaps. |
|
Merged via squash.
|
…safe (openclaw#102484) * fix(gateway): keep live chat assistant buffer tail truncation UTF-16 safe * test(gateway): cover UTF-16 tail cap through merge path --------- Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
capLiveAssistantBuffer()inlive-chat-projector.tsusestext.slice(-MAX_LIVE_CHAT_BUFFER_CHARS)for tail truncation of the assistant live chat buffer. A negative slice can split a surrogate pair at the leading edge, causing the 500,000-character live buffer to start with a broken�character.Why This Change Was Made
This is the only remaining negative-slice tail truncation in
src/gateway/that is not surrogate-safe. It now usessliceUtf16Safe()from@openclaw/normalization-core/utf16-slice, which adjusts the slice boundary to avoid splitting surrogate pairs.Unlike the other truncation fixes (which use
truncateUtf16Safefor positive-index prefix truncation), this one requiressliceUtf16Safewith a negative start index to preserve the tail behavior.User Impact
Evidence
live-chat-projector.test.ts(new file, tests previously untested function)🤖 Generated with Claude Code