fix(gateway): keep plugin approval title and description truncation UTF-16 safe#101478
fix(gateway): keep plugin approval title and description truncation UTF-16 safe#101478wm0018 wants to merge 6 commits into
Conversation
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Codex review: needs real behavior proof before merge. Reviewed July 7, 2026, 6:37 AM ET / 10:37 UTC. Summary Reproducibility: yes. from source: current main slices plugin approval titles/descriptions at raw UTF-16 code-unit boundaries, and the shared helper tests show why surrogate-boundary truncation needs Review metrics: 3 noteworthy metrics.
Stored data model Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Maintainer decision needed
Security Review findings
Review detailsBest possible solution: Keep the UTF-16-safe gateway truncation change, but land it through a narrowed/rebased gateway-only PR or an explicit maintainer-owned adoption of the broader branch with full owner review and proof. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main slices plugin approval titles/descriptions at raw UTF-16 code-unit boundaries, and the shared helper tests show why surrogate-boundary truncation needs Is this the best way to solve the issue? The two-line gateway change is the right narrow fix for the truncation bug, but the current PR branch is not the best merge shape because it includes hundreds of unrelated changes and is conflicted. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 942b44966107. Label changesLabel changes:
Label justifications:
Evidence reviewedSecurity concerns:
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
Review history (4 earlier review cycles)
|
…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 #???
3d47367 to
c2df578
Compare
|
The useful fix has landed in clean replacement #101580 as commit This branch accumulated six repeated fixup commits, a stale merge base, 301 unrelated changed files, and merge conflicts, so landing it directly was no longer safe. The replacement contains only the two intended gateway files, passed 28 focused Blacksmith Testbox tests across four gateway projects, fresh clean autoreview, 69 exact-head hosted checks, and the native prepare gate. Closing as superseded. Thank you for finding and fixing the plugin approval boundary. |
What Problem This Solves
Fixes an issue where plugin approval requests rendered broken U+FFFD replacement characters (
�) in the gateway approval UI when the approval title or description contained an emoji or CJK supplementary character at the truncation boundaries (80 characters for title, 256 for description).String.prototype.slice(0, n)cuts at UTF-16 code unit boundaries. Emoji like 🚀 are surrogate pairs (2 code units). When a pair straddles the cut position, the lone high surrogate renders as�in downstream approval UI clients.Why This Change Was Made
Replace
input.title.slice(0, 80)andinput.description.slice(0, 256)withtruncateUtf16Safe— the standard UTF-16-safe truncation helper already used across the codebase.truncateUtf16Safedetects incomplete surrogate pairs and backs out to the last whole character instead of splitting them.User Impact
Plugin approval requests with emoji or CJK supplementary characters near the truncation limits now deliver cleanly truncated text to the gateway approval UI, without broken replacement characters.
Evidence
Standalone proof (production helper, same head)
Tests
Files Changed (2 files, +24/-2)