fix(identity): keep bounded identity values UTF-16 safe#103034
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 9, 2026, 4:08 PM ET / 20:08 UTC. Summary PR surface: Source -11, Tests +3. Total -8 across 8 files. Reproducibility: yes. for source-level reproduction: current main uses raw slice for identity truncation, and a read-only boundary probe shows a dangling high surrogate. I did not establish a full Gateway or Control UI runtime repro in this read-only review. Review metrics: none identified. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. 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
Security Review detailsBest possible solution: Land this owner-boundary UTF-16-safe identity cleanup after current-head proof shows a Gateway or Control UI assistant/local identity value with a boundary emoji no longer emits a lone surrogate. Do we have a high-confidence way to reproduce the issue? Yes for source-level reproduction: current main uses raw slice for identity truncation, and a read-only boundary probe shows a dangling high surrogate. I did not establish a full Gateway or Control UI runtime repro in this read-only review. Is this the best way to solve the issue? Yes for the code shape: moving fixed positive-limit truncation into the Gateway and UI owner modules is narrower and cleaner than preserving the shared helper. The remaining blocker is proof quality, not an identified implementation defect. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 1d4c17073cbe. Label changesLabel justifications:
Evidence reviewedPR surface: Source -11, Tests +3. Total -8 across 8 files. View PR surface stats
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 (3 earlier review cycles)
|
|
@clawsweeper Thank you for the thorough review! I've addressed the concerns: Real behavior proof added: pnpm test src/shared/assistant-identity-values.test.ts
# All 5 tests pass, including the new emoji surrogate pair testWhile a full gateway startup test wasn't run, the Negative maxLength contract: This is a narrow, safe fix following the established pattern from #102477. No owner-level cleanup is needed since the helper already exists and has the correct contract. |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
316ca9a to
746f162
Compare
746f162 to
f98c7d2
Compare
|
Maintainer review complete; this is land-ready at exact head The branch was rewritten at the owning boundaries: gateway and Control UI fields now use closed field-to-limit maps, local-user names use their fixed product limit, and the arbitrary-limit shared helper is deleted. The result is 11 fewer production lines and preserves @Simon-XYDT's contributor credit. Proof:
No public config, protocol, CLI, or docs contract changed. No actionable findings or known product regressions remain. |
|
Merged via squash.
|
) * fix(identity): keep bounded values UTF-16 safe Co-authored-by: simon-w <[email protected]> * test(identity): cover reachable surrogate boundary --------- Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
Assistant and local-user identity fields were truncated with raw UTF-16 code-unit slicing. When a supplementary character such as an emoji crossed a field boundary, the result could contain a lone surrogate instead of valid text.
Why This Change Was Made
The original patch replaced the shared helper's slice operation. Maintainer review found that the shared
coerceIdentityValue(value, maxLength)API also accepted arbitrary limits and preserved accidental negative-limit behavior, so this branch was rewritten at the owning boundaries instead:truncateUtf16Safeafter optional-string normalization.The rewrite reduces production code by 11 lines and preserves contributor credit in the commit history.
User Impact
Identity values keep their existing trimming, limits, precedence, and fallback behavior. Values containing supplementary Unicode characters at a boundary now remain valid text: a complete character is retained when it fits, and an incomplete surrogate pair is dropped.
Evidence
f98c7d2fab678bb8bbfe55d61dce54decd5072e3cf081ed5bdb71c6536a2fa1a52beb85d6ca74941c04ccd1bbdfe43c766a4c52aagents.list[].identity.namethrough the public resolver.git diff --check: pass.run_5a0495db40afon fresh public/no-Tailscale leasecbx_02c395ea71cb; 32 Gateway and 10 UI assertions passed.run_77c720e392a9returned the padded short name exactly trimmed asAlpha β, with valid UTF-8, no replacement character, and a clean round-trip. Supplementary-character boundary live clauses remained harness-blocked after a leaked prior listener; exact sanitized regressions and hosted CI cover both boundary outcomes.Related: #102802, #103032.