Skip to content

fix(crestodian): use truncateUtf16Safe for conversation text truncation#102770

Closed
lzyyzznl wants to merge 1 commit into
openclaw:mainfrom
lzyyzznl:fix/truncateUtf16Safe-crestodian
Closed

fix(crestodian): use truncateUtf16Safe for conversation text truncation#102770
lzyyzznl wants to merge 1 commit into
openclaw:mainfrom
lzyyzznl:fix/truncateUtf16Safe-crestodian

Conversation

@lzyyzznl

@lzyyzznl lzyyzznl commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

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

Why This Change Was Made

src/crestodian/assistant-prompts.ts uses raw .slice(0, HISTORY_TURN_MAX_CHARS) for conversation history truncation. Replacing with truncateUtf16Safe ensures the displayed text is always valid Unicode.

User Impact

Truncated conversation history in Crestodian 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
@lzyyzznl lzyyzznl closed this Jul 9, 2026
@lzyyzznl lzyyzznl reopened this 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(crestodian): use truncateUtf16Safe for conversation 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 this tiny cross-owner bundle in favor of the wider UTF-16 cleanup. It changes three unrelated production sites without focused tests, overlaps prior embedding work, and the stream-normalizer half only fixes prefix slicing while leaving its suffix edge independently unsafe. The valid sites should be consolidated by owner with active-path regression coverage, including both stream boundaries.

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.

2 participants