Skip to content

fix(stream-normalizer): use truncateUtf16Safe for text truncation#102775

Closed
coder-master-0915 wants to merge 2 commits into
openclaw:mainfrom
coder-master-0915:fix/truncateUtf16Safe-stream-normalizer
Closed

fix(stream-normalizer): use truncateUtf16Safe for text truncation#102775
coder-master-0915 wants to merge 2 commits into
openclaw:mainfrom
coder-master-0915:fix/truncateUtf16Safe-stream-normalizer

Conversation

@coder-master-0915

Copy link
Copy Markdown

What Problem This Solves

One .slice(0, N) truncation site may cut UTF-16 surrogate pairs in half when the text contains multi-byte characters such as emoji.

Why This Change Was Made

Replacing .slice(0, N) with truncateUtf16Safe ensures truncated output is always valid Unicode.

User Impact

Truncated text remains valid Unicode at existing size limits. No behavioral changes for ASCII-only content.

Generated with Claude Code

@openclaw-barnacle openclaw-barnacle Bot added size: XS triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Jul 9, 2026
@clawsweeper

clawsweeper Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper status: review started.

I am starting a fresh review of this pull request: fix(stream-normalizer): use truncateUtf16Safe for text truncation This is item 1/1 in the current shard. Shard 0/1.

This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

@vincentkoc vincentkoc self-assigned this Jul 9, 2026
@vincentkoc

Copy link
Copy Markdown
Member

Closing as a later subset of #102770. This duplicates the untested Crestodian/stream-normalizer substitutions, and the stream change remains one-sided because the suffix slice can still split a surrogate pair. #102770 is also closed so the valid sites can be consolidated into the wider UTF-16 cleanup with both-edge active-path coverage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: XS triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants