Files
openclaw/extensions/crabbox
wangmiao0668000666 c155e4dbd8 fix(crabbox): preserve UTF-16 boundaries in CLI failure detail truncation (#104612)
* fix(crabbox): preserve UTF-16 boundaries in CLI failure detail truncation

commandDetail replaced raw .slice(0, MAX_ERROR_DETAIL_CHARS) with
truncateUtf16Safe on the whitespace-compressed error detail output.
A 511-code-unit prefix with an emoji at the boundary produces a lone
high surrogate (U+D83D) on current main; the shared surrogate-aware
helper backs the cut up to preserve well-formed UTF-16.

* fix(crabbox): add provider-path UTF-16 regression test for inspect boundary

The existing test exercised commandDetail directly; ClawSweeper's P1
requires proof through the real provider boundary.  The new test calls
provider.inspect() with a CLI runner that returns 511 ASCII + emoji in
stderr, proving commandDetail → truncateUtf16Safe works through the
full inspect → commandError → commandDetail chain.

Co-Authored-By: Claude <noreply@anthropic.com>

* refactor(crabbox): keep error proof on provider path

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Peter Steinberger <steipete@gmail.com>
2026-07-11 12:50:47 -07:00
..