Skip to content

fix(gateway): preserve UTF-16 plugin approval fields#101580

Merged
steipete merged 2 commits into
mainfrom
codex/utf16-plugin-approval
Jul 7, 2026
Merged

fix(gateway): preserve UTF-16 plugin approval fields#101580
steipete merged 2 commits into
mainfrom
codex/utf16-plugin-approval

Conversation

@steipete

@steipete steipete commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Plugin approval titles and descriptions were capped with raw UTF-16 slicing. An emoji or other supplementary character crossing the 80/256-code-unit boundaries produced a lone surrogate in the gateway approval payload.

This clean current-main replacement supersedes #101478, whose branch accumulated repeated fixup commits, 301 unrelated changed files, and merge conflicts.

Why This Change Was Made

The gateway node-invoke policy owner now uses the canonical normalization-core UTF-16 helper at the existing caps. The regression drives a real dangerous plugin policy through pending approval creation and inspects the stored request fields.

The original implementation commit and @wm0018 authorship are preserved.

User Impact

Plugin approval prompts remain valid when capped text contains emoji or supplementary CJK characters. Approval routing, timeouts, and length limits are unchanged.

Evidence

  • node scripts/crabbox-wrapper.mjs run -- corepack pnpm test src/gateway/node-invoke-plugin-policy.test.ts — 28 tests passed across four gateway projects on Blacksmith Testbox tbx_01kwy3bk8pkgs7d418tezxk73a (run).
  • Fresh Codex autoreview: clean; no accepted/actionable findings, correctness 0.91.
  • oxfmt --check on both touched files — passed.
  • git diff --check — passed.

wm0018 and others added 2 commits July 7, 2026 11:51
…TF-16 safe

Node.js String.prototype.slice cuts at UTF-16 code unit boundaries,
which can split surrogate pairs (emoji, CJK supplementary characters)
into lone surrogates that render as U+FFFD in approval UI payloads.

Use truncateUtf16Safe for both title and description fields in
createPluginApprovalsAttachment so approval requests never deliver
broken characters to the gateway approval UI.

Fixes #???
@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: XS maintainer Maintainer-authored PR labels Jul 7, 2026
@clawsweeper

clawsweeper Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper status: review started.

I am starting a fresh review of this pull request: fix(gateway): preserve UTF-16 plugin approval fields 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 commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

Land-ready at exact reviewed head 9c3c2fc90e7644634f5b4152b8c6d935be8f752a.

  • Rebuilt the useful two-file change from fix(gateway): keep plugin approval title and description truncation UTF-16 safe #101478 on current main after that branch accumulated six repeated commits, 301 unrelated changed files, and conflicts.
  • Preserved @wm0018's original implementation commit and authorship.
  • Plugin approval titles/descriptions now use the canonical normalization-core UTF-16 helper at the existing 80/256-code-unit caps.
  • The regression drives a real dangerous plugin policy through pending approval creation and resolution.
  • Blacksmith Testbox tbx_01kwy3bk8pkgs7d418tezxk73a: 28 tests passed across four gateway projects (run).
  • Fresh Codex autoreview: clean, no accepted/actionable findings (correctness 0.91).
  • oxfmt on both touched files and git diff --check: passed.
  • Exact-head hosted CI: 69 checks passed; none failed or pending.
  • Native OPENCLAW_TESTBOX=1 scripts/pr prepare-run 101580: passed exact-head hosted gates.

No docs or changelog change is required for this internal approval-payload boundary correction.

@steipete
steipete merged commit 2fe3969 into main Jul 7, 2026
122 of 125 checks passed
@steipete
steipete deleted the codex/utf16-plugin-approval branch July 7, 2026 11:06
@steipete

steipete commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 8, 2026
* fix(gateway): keep plugin approval title and description truncation UTF-16 safe

Node.js String.prototype.slice cuts at UTF-16 code unit boundaries,
which can split surrogate pairs (emoji, CJK supplementary characters)
into lone surrogates that render as U+FFFD in approval UI payloads.

Use truncateUtf16Safe for both title and description fields in
createPluginApprovalsAttachment so approval requests never deliver
broken characters to the gateway approval UI.

Fixes #???

* test(gateway): exercise UTF-16 approval payloads

---------

Co-authored-by: wm0018 <[email protected]>
giodl73-repo pushed a commit to giodl73-repo/openclaw that referenced this pull request Jul 8, 2026
* fix(gateway): keep plugin approval title and description truncation UTF-16 safe

Node.js String.prototype.slice cuts at UTF-16 code unit boundaries,
which can split surrogate pairs (emoji, CJK supplementary characters)
into lone surrogates that render as U+FFFD in approval UI payloads.

Use truncateUtf16Safe for both title and description fields in
createPluginApprovalsAttachment so approval requests never deliver
broken characters to the gateway approval UI.

Fixes #???

* test(gateway): exercise UTF-16 approval payloads

---------

Co-authored-by: wm0018 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime maintainer Maintainer-authored PR size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants