Skip to content

fix(scripts): keep Anthropic prompt previews UTF-16 safe#112044

Merged
steipete merged 1 commit into
mainfrom
fix/anthropic-prompt-probe-utf16
Jul 21, 2026
Merged

fix(scripts): keep Anthropic prompt previews UTF-16 safe#112044
steipete merged 1 commit into
mainfrom
fix/anthropic-prompt-probe-utf16

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Anthropic prompt-capture summaries truncated normalized system/user text with raw String.slice. If the 119-code-unit preview boundary landed inside an emoji or another supplementary-plane character, the JSON preview could contain a dangling UTF-16 surrogate.

Why This Change Was Made

The probe now uses the canonical truncateUtf16Safe helper from normalization-core at its existing boundary. This preserves whitespace normalization, the 120-code-unit budget, and the ellipsis while keeping captured prompt previews well formed.

The batch-wide sibling sweep found this remaining model-visible scripts boundary after the Firecrawl, labeler, and tool-surface bench fixes.

User Impact

scripts/anthropic-prompt-probe.ts no longer emits malformed system-block or user-prompt previews when captured text crosses a surrogate-pair boundary. Ordinary ASCII/BMP preview output is unchanged.

Evidence

No public API, configuration, dependency, storage, protocol, or secret-handling behavior changes.

@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts size: XS maintainer Maintainer-authored PR labels Jul 21, 2026
@steipete
steipete marked this pull request as ready for review July 21, 2026 03:38
@clawsweeper

clawsweeper Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper status: review started.

I am starting a fresh review of this pull request: fix(scripts): keep Anthropic prompt previews UTF-16 safe 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.

Use the shared UTF-16 truncation helper so captured Anthropic system and user prompt previews never emit dangling surrogate halves.
@steipete
steipete force-pushed the fix/anthropic-prompt-probe-utf16 branch from d9cf2ad to c6724e5 Compare July 21, 2026 03:51
@clawsweeper

clawsweeper Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper status: review started.

I am starting a fresh review of this pull request: fix(scripts): keep Anthropic prompt previews UTF-16 safe 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.

@steipete
steipete merged commit bb45eda into main Jul 21, 2026
99 checks passed
@steipete
steipete deleted the fix/anthropic-prompt-probe-utf16 branch July 21, 2026 03:58
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 21, 2026
Use the shared UTF-16 truncation helper so captured Anthropic system and user prompt previews never emit dangling surrogate halves.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR scripts Repository scripts size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant