Skip to content

fix(embedding-provider): use truncateUtf16Safe for text truncation#102774

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

fix(embedding-provider): use truncateUtf16Safe for text truncation#102774
coder-master-0915 wants to merge 2 commits into
openclaw:mainfrom
coder-master-0915:fix/truncateUtf16Safe-embedding-provider

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(embedding-provider): 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. The Crestodian and embedding substitutions are untested UTF-16 micro-fragments, and the embedding half also overlaps #102744. #102770 is also being closed so the genuinely arbitrary-text sites can be handled once in the wider canonical cleanup with owner-specific active-path tests.

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