Repository navigation
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
…racter assistantCitationLabel cut a quote or its comment at 64 UTF-16 code units. When an emoji straddled the cut, the label kept only its high surrogate, so it ended in a replacement character before the ellipsis. That shows in the quote chip of a sent message on a desktop-width window, in the chip's screen-reader labels and in the text find-in-thread searches. The composer chip clips its label to one 16em line, so the broken end never shows there. The cut now steps back one unit when it would land between a high and a low surrogate, the same check pingdotgg#29158 added to context chip labels. Bug: a long assistant quote chip ends in a broken character when an emoji sits at the cut
beaea4d to
4a68ff9
Compare
|
Note Written by Verified in a real dev environmentverified unchanged head
blacksmith checks passed: 30 focused citation/search tests, plus before, main: after, same saved message on the pr: selection, citation creation, popover, source navigation and sending: real provider response to the two citations: Not verifiednative electron, ios/android, macos/windows, an actual screen reader, and remote/relay connections were not exercised on this linux web run. accessible DOM labels were inspected directly. this vm lacks a rocket emoji font, so the full emoji appears as a missing glyph in the captures; its unicode and delivery to codex were verified. find-in-thread was covered by the existing focused tests, not a browser interaction. |




Problem
When an assistant quote is 64 UTF-16 code units or longer and an emoji straddles that point, the quote chip's label keeps only the emoji's high surrogate, so it ends in a replacement character (�) right before the
…. It should end on the last whole character before the emoji, as #29158 made context chip labels do.Change
The label comes from
assistantCitationLabelinpackages/shared/src/assistantCitations.ts, which cuts the quoted text, or the comment bound to it, at 64 UTF-16 code units and adds…. When the cut would land between a high and a low surrogate, it now steps back one unit. That is the check #29158 added tosanitizeComposerContextLabel, and #29163 and #29563 use it for thread titles. The 64-unit limit, the…suffix and every label without a split emoji are unchanged.Where the broken end showed, on web and desktop:
View cited assistant text: <label>andQuoted assistant text: <label>.The chip in the composer uses the same label but clips it to one line of 16em, so the broken end never shows there. Mobile is not affected: it renders a citation as the full quote, not as this label. The citation the message stores is unchanged; the label is computed when the chip renders, so messages already sent show the fixed label too.
Scope and approval
This is a very small, focused fix for an obvious bug. It is the defect #29158 ("context chip labels no longer split an emoji at the 200-character cap") fixed in the shared chip label cap, still present in the label of the other chip the composer makes, the assistant quote chip. It applies the same check and changes no other behaviour, setting or contract.
Overlap check, by
assistantCitationLabeland by file. #28084, #28088 and #23473 changeassistantCitations.tsand its test, but none touchesassistantCitationLabel. #23473's test hunk sits near this PR's new case, a few lines apart. #22148 adds a newassistantCitationLabelcaller in the collapsed composer preview and would show the fixed label. #29386 (mobile citing) does not touch these files. #24611 changes the sharedtruncate, which this function does not call.Verification
packages/shared/src/assistantCitations.test.tsgets one case in its existingassistant citation referencesblock. No case coveredassistantCitationLabelbefore. It labels a quote of 63as followed by😀, so the emoji sits on the cut.On
mainwith only the test commit (3f9a882), frompackages/shared,vp test run src/assistantCitations.test.ts:With the fix:
vp test run src/assistantCitations.test.ts src/threadFindText.test.tsinpackages/shared: 2 files, 30 tests passed.vp run check:changedfrom the repo root: format, lint, knip, typecheck (34 packages) and tests (3 files) all pass.In a running dev build (web, Windows): the free Replay provider replied with the line "Rename the config loader so it reads from the new paths first, 🚀 then ship the change.", whose first 63 UTF-16 code units come before the emoji. I selected that line, clicked "Cite selection in composer" and sent the message with
main'sassistantCitations.ts, then reloaded with this branch's. The same sent message:main)The Replay reply text was edited locally for this run only. The captures are the preview panel's visible area (951 by 701), not the full window.
What I could not check: desktop and the screen-reader labels with an actual screen reader. Like #29158, the cut works per code point, so it can still split a grapheme cluster such as a flag, a skin-tone modifier or a ZWJ sequence; it never leaves a lone surrogate.
Bug: a long assistant quote chip ends in a broken character when an emoji sits at the cut
This was written with Claude Opus 5.5 in Claude Code, driven from T3 Code.