fix(gateway): keep session title and preview text truncation UTF-16 safe#102090
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 8, 2026, 11:48 PM ET / 03:48 UTC. Summary PR surface: Source 0, Tests +19. Total +19 across 4 files. Reproducibility: yes. Source inspection shows current main cuts both title and preview text with raw UTF-16 Review metrics: none identified. 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
Security Review detailsBest possible solution: Land the narrow helper reuse after the contributor adds preview-path terminal or live output and exact-head checks finish; no broader gateway API change is needed. Do we have a high-confidence way to reproduce the issue? Yes. Source inspection shows current main cuts both title and preview text with raw UTF-16 Is this the best way to solve the issue? Yes for the code shape: reusing the existing surrogate-safe truncation helper at both raw truncation sites is the narrow maintainable fix. Merge readiness is still blocked by missing real preview-path proof, not by a code finding. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 2cb482dd40ad. Label changesLabel justifications:
Evidence reviewedPR surface: Source 0, Tests +19. Total +19 across 4 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)
|
64be49c to
a772186
Compare
a772186 to
934dbdb
Compare
|
Land-ready review complete on exact head
No remaining findings or proof gaps. |
|
Merged via squash.
|
…afe (openclaw#102090) * fix(gateway): keep session title and preview text truncation UTF-16 safe * test(gateway): cover session UTF-16 boundaries in place --------- Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
Fixes two UTF-16 truncation sites in gateway session utilities that could produce broken U+FFFD replacement characters:
truncateTitle (src/gateway/session-utils.ts) — truncates user messages at 59 code units when deriving session titles via deriveSessionTitle. Emoji at the boundary produces a broken character visible in session lists and the /name command.
truncatePreviewText (src/gateway/session-utils.fs.ts) — truncates transcript message text at maxChars-3 code units for session preview items served via the sessions API.
Why This Change Was Made
User Impact
Session titles derived from user messages and session preview items no longer contain broken characters at truncation boundaries.
Evidence
Tests
Production-path proof
Files Changed (4 files, +94/-3)