Files
openclaw/scripts/repro
pick-cat 74e2c2afdd fix(scripts): preserve surrogate pairs when truncating LLM text in bench dump (#110546)
* fix(scripts): use truncateUtf16Safe for LLM text truncation in bench dump

Three .slice(0, N) calls truncate assistant/tool result/final text for
logging output. Raw String.prototype.slice operates on UTF-16 code
units and can split surrogate pairs (emoji, CJK characters) straddling
the cut boundary, producing invalid Unicode in trail and result output.

Replace with truncateUtf16Safe from @openclaw/normalization-core/utf16-slice,
the same helper already used across the codebase for safe boundary truncation.

Co-Authored-By: nebulacoder-v8.0 <noreply@zte.com.cn>

* test(scripts): add behavioral proof for UTF-16 safe truncation in bench dump

Co-Authored-By: Pick-cat <huang.ting3@xydigit.com>

* test(scripts): replace root proof harness with repository-native bench dump truncation tests

Remove the 163-line root-level proof artifact and add focused vitest
tests in test/scripts/ that exercise the exact truncateUtf16Safe call
sites and format strings used by the bench script — without needing a
live LLM benchmark run.

Co-Authored-By: Pick-cat <huang.ting3@xydigit.com>

* test(scripts): remove redundant UTF-16 helper coverage

---------

Co-authored-by: nebulacoder-v8.0 <noreply@zte.com.cn>
Co-authored-by: Peter Steinberger <steipete@gmail.com>
2026-07-20 19:25:02 -07:00
..