Repository navigation
fix(website): keep emoji whole when truncating remaining labels - #24796
iamwhatever merged 1 commit into
Conversation
Design Review (Opus 5.5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS This is a narrow fix for invalid UTF-16 that reuses the existing helper. It takes nothing away and changes no visual layout, so no screenshot is needed. Notes
[DESIGN-REVIEWED] c600ff7 Description read[DESCRIPTION-READ] b275a71cd1becf85c19b6a040600f9eb412d9df2765aa33eda2ebaf306298dba That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5, fork) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. Every site now uses the existing Notes
What this change shipsInventory (6 items) — 6 justifiedIntent: stop truncated dashboard labels from ending in a broken
[FIRST-PRINCIPLES-REVIEWED] c600ff7 Description read[DESCRIPTION-READ] 60c1dd2c15c177e76b35fdf18fceafd7391c30abbf02555c41f5f5f2fbfd04b9 That sha256 names the PR description this verdict read. Recompute it with |
UX Review (Opus 5.5, fork) — ✅ PASSUX-level review of UX-Verdict: PASS Nothing to check. The diff only changes where existing labels are cut, so an emoji at the cut is no longer split into a broken [UX-REVIEWED] c600ff7 Description read[DESCRIPTION-READ] d36c1abccbc0556f849ba4554bdd2ce5d41313b6c58724013da2114a5bcd1741 That sha256 names everything this verdict read: the PR description, plus the 3 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Opus 5.5 Review (fork) — ✅ no blocking findingsReviewed |
GPT 6.1 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
iamwhatever
left a comment
There was a problem hiding this comment.
REQUEST_CHANGES at 673ed34.
The fix is right at every site it touches. Each cut now goes through the existing sliceCodePoints, which only shortens a cut that would split a surrogate pair, so every cap still holds. CI is green.
Two items need tracking or an answer before approval:
- This PR says
Closes #24727, but one site on that issue's list stays broken:SubagentCompletionCard.tsx(L47) still uses.slice(0, 120). The description defers it to #24710, but #24710's version of that line isname.slice(0, 120), which has the same bug. Fix it here, changeClosestoPart of #24727, or open an issue for it and link it in the description. - The Design note has no reply. It suggests moving
sliceCodePointsout of the React component fileCommentOverlay.tsxintoutils/orlib/, now that pure modules import it. Reply on the PR, do the move, or open an issue and link it.
— crew-pr-reviewer (r129)
Twenty-two dashboard cuts used a UTF-16 .slice(0, n). When an emoji straddled the cap, the label kept the emoji's lone high surrogate, which renders as U+FFFD. Each site now cuts with the existing exported sliceCodePoints from components/CommentOverlay, so the end edge moves off a surrogate pair and every cap still holds. Sites: selection notice quote, browser annotation label, flying quote, issue-radar graph title and jump option, Mochi approval label, memory restore label, collapsed draft line, widget action text, scene agent name and tooltip, dropped theme rule id, memory carve previews, the seven workflow run tree cuts, and the subagent completion card headline task (pages/chat/SubagentCompletionCard.tsx:47), the last site kirodotdev#24727 lists. The remaining design note on kirodotdev#24796 — moving sliceCodePoints out of the CommentOverlay component into utils/ — is tracked in kirodotdev#24983, since the move rewrites an import line in ~15 files, several edited by open PRs. Closes kirodotdev#24727
673ed34 to
a477498
Compare
|
Thanks — both addressed in
Local gates green on the final tree (tsc, eslint, i18n, file-line-cap); |
Twenty-two dashboard cuts used a UTF-16 .slice(0, n). When an emoji straddled the cap, the label kept the emoji's lone high surrogate, which renders as U+FFFD. Each site now cuts with the existing exported sliceCodePoints from components/CommentOverlay, so the end edge moves off a surrogate pair and every cap still holds. Sites: selection notice quote, browser annotation label, flying quote, issue-radar graph title and jump option, Mochi approval label, memory restore label, collapsed draft line, widget action text, scene agent name and tooltip, dropped theme rule id, memory carve previews, the seven workflow run tree cuts, and the subagent completion card headline task (pages/chat/SubagentCompletionCard.tsx:47), the last site kirodotdev#24727 lists. The remaining design note on kirodotdev#24796 — moving sliceCodePoints out of the CommentOverlay component into utils/ — is tracked in kirodotdev#24983, since the move rewrites an import line in ~15 files, several edited by open PRs. Closes kirodotdev#24727
a477498 to
c600ff7
Compare
|
@github-actions (GPT 6.1 Review) — fixed in
|
|
HOLD at c600ff7. Both items from our r129 change request are resolved. One small item is still open: First Principles notes that the description lists — crew-pr-reviewer (r131) |
iamwhatever
left a comment
There was a problem hiding this comment.
APPROVE at c600ff78683c0321a57464b9b4a875c6dc1aa887.
Every changed site now cuts through the existing sliceCodePoints, which only moves an end edge back off a split surrogate pair (CommentOverlay.tsx L156-L166), so each cap still holds and text without astral characters truncates exactly as before. Our r129 items are resolved: SubagentCompletionCard.tsx is fixed with a regression test, and the helper move is tracked in #24983. All checks are green and the GPT and Opus lanes have no findings.
AI findings judged non-blocking
- First Principles — description names the wrong path for the MemoryRecordsEditor test: a description wording nit; the test ships at website/src/test/MemoryRecordsEditor.truncate.test.tsx.
- Design — pure modules now import the
CommentOverlay.tsxcomponent file: no behaviour or build harm (CI green, no Electron or Node importer of those modules), and the move toutils/is tracked in #24983 (themeCss.ts L25).
— crew-pr-reviewer (r132)
Problem / Motivation
Goal: No dashboard label, preview or notice listed in #24727 shows a broken
�glyph when it cuts text next to an emoji.Each site below cuts text with a UTF-16
.slice(0, n). When an emoji (or any astral character) straddles the cap, the slice keeps the emoji's high surrogate and drops the low one, so the text ends in a lone surrogate, which renders as�. For example, a browser annotation whose accessible name is 38 ASCII characters followed by🎉is labelledaaaa…aaa�….Why it matters
The broken glyph lands on text the user or an agent wrote: a quoted selection, an annotation label, a memory preview, an agent or cron name, a workflow phase title, an error message, a sub-agent's task. It reads as corruption. The widget action text is also handed to the composer, so a lone surrogate there becomes invalid Unicode in a message the user may send.
Not a goal
sliceCodePointsout of theCommentOverlay.tsxcomponent intoutils/: tracked in refactor(website): move sliceCodePoints out of the CommentOverlay component into utils/ #24983. The move rewrites an import line in ~15 files, several of which other open PRs are editing, so it is kept out of this behavioural fix (see Design note below).chat-core/composer/messageQuote.ts,pages/chat/share/shareSupport.ts,utils/trustPatterns.ts) onto the shared helper. They already produce valid text; that move is a refactor, not part of this fix.What changed (motivation → approach → change)
Symptom:
�at the end of a truncated label. Root cause: the UTF-16 slice ends between the two halves of a surrogate pair. Change: every site now cuts with the existing exportedsliceCodePoints(s, 0, n)fromwebsite/src/components/CommentOverlay.tsx(the helper #24753 uses), so no new copy of the surrogate check is added. When an end edge would split a pair, the helper moves it back one unit. The cut can only get shorter, so every cap still holds. An emoji that ends exactly at the cap is kept. Text without astral characters truncates exactly as before.website/src/hooks/useSelectionComposerAnchor.tsclipQuote: selection notice quote (48).website/src/utils/browserAnnotations.tstruncate: browser annotation label (40).website/src/components/FlyingQuote.tsx: flying quote text (60).website/src/apps/issue-radar/views/GraphView.tsx: focus-tree node title (26) and the jump list<option>(50, same file, same cut).website/src/apps/mochi/panel/approvalActions.tsapprovalLabel: approval command line (72).website/src/pages/overview/MemoryRecordsEditor.tsxshortBody: restore button label (40).website/src/pages/chat/SubagentCompletionCard.tsxheadline: sub-agent completion task (120). This is the site More dashboard labels can cut an emoji in half when truncated #24727 lists that was previously deferred.website/src/components/chat-input/collapse.tsxcollapsedDraftLine: collapsed draft line (120).website/src/components/WidgetFrame.tsx: widget action text handed to the composer (MAX_WIDGET_ACTION_TEXT).website/src/hooks/useAgentSync.tsshortName: scene agent name (45).website/src/hooks/useSceneInteraction.tsxmessagePreview: scene tooltip (64).website/src/hooks/themeCss.ts_droppedRuleId: dropped theme rule id in Settings (80).website/src/pages/overview/MemoryCarveCard.tsx: memory row preview, mobile card and table cell (160).website/src/apps/workflows/WorkflowRunTree.tsx: phase title (80), agent label (100), last tool (60), narrator log line (200), both error notices (200), result JSON (2000).Backwards compatibility
Compatible: every function and component keeps its signature and cap. Output changes only when it used to end in a lone high surrogate, which is invalid UTF-16 that no caller can use.
Removes nothing: the change drops one malformed code unit from a display string and touches no stored data, key, route or public function.
Tests
Each new test sets up a site so that an emoji (
🎉or😀) straddles the cap, then asserts the exact truncated text and that no lone high surrogate is left. A second case puts the emoji so it ends exactly at the cap and checks it is kept whole.website/src/hooks/useSelectionComposerAnchor.truncate.test.tsx: refusal notice quote, throughonRefusedAfterClose.website/src/test/browserAnnotations.truncate.test.ts:annotationLabel.website/src/test/FlyingQuote.truncate.test.tsx: rendered quote text.website/src/apps/issue-radar/views/GraphView.truncate.test.tsx: focus-tree SVG title and jump<option>text.website/src/apps/mochi/test/approvalActions.truncate.test.ts:approvalLabel.website/src/pages/overview/MemoryRecordsEditor.truncate.test.tsx: restore button label.website/src/test/SubagentCompletionCard.test.tsx: added "keeps an emoji whole when the headline cut lands mid-surrogate-pair" (119 ASCII +😀straddling the 120-unit cap). It fails on the pre-fix.slice(0, 120)— the headline ends in a lone high surrogate — and passes onsliceCodePoints.website/src/components/chat-input/collapse.truncate.test.tsx:useComposerCollapse().collapsedDraftLine.website/src/components/WidgetFrame.truncate.test.tsx:mc-widget-senddetail text.website/src/test/useAgentSync.truncate.test.tsx: cron agent name.website/src/test/useSceneInteraction.truncate.test.ts:messagePreview.website/src/test/themeCss.truncate.test.ts:scopeOverridesCss().droppedRules.website/src/pages/overview/MemoryCarveCard.truncate.test.tsx: mobile card and table cell.website/src/apps/workflows/WorkflowRunTree.truncate.test.tsx: all seven cuts.TDD for the SubagentCompletionCard site: with the production line reverted to
.slice(0, 120)the new test fails (received string ends in\ufffdbefore the…); withsliceCodePointsit passes. The fullSubagentCompletionCard.test.tsxsuite (57 tests) andCommentOverlay.test.tspass.Local gates on the final tree:
tsc -p tsconfig.app.json --noEmitclean,eslinton every changed file clean,node scripts/check-i18n-strings.mjsOK,python3 scripts/check_file_line_cap.py0 failures.Manual verification
N/A — unit coverage is enough. Each site's output is a plain string the tests read directly, or through the rendered DOM node the user sees.
Screenshots / video
Why no screenshot: the only rendered change is that a label which used to end in
�…now ends in…, at a cap position that needs crafted input to reach, and the tests assert those exact strings.Design note
The reviewer suggested moving
sliceCodePoints(andsnapOffPair) out of the React componentCommentOverlay.tsxinto a pure module underutils/, now that pure modules import it. That is the right home, but the move rewrites an import line in ~15 files acrossutils/,lib/,hooks/,apps/,pages/andcomponents/, several of which are being edited by open PRs (e.g. #20493 onCommentOverlay, #16481 / #17525 / #19820 / #19824 / #22674 / #23854 on changed files). Folding it in here would balloon this PR's diff and collide with those PRs on the import lines, so it is tracked as its own refactor in #24983 and left out of this behavioural fix.Related Issues
Closes #24727
Design-note follow-up: #24983
Sibling sweep
Swept:
git grep -nE "\.slice\(0, [^)]+\)( \+ '…'|}…)" -- website/srcplus the sites listed on #24727 and its commentsSibling: website/src/hooks/useSelectionComposerAnchor.ts:36 -- changed here
Sibling: website/src/utils/browserAnnotations.ts:46 -- changed here
Sibling: website/src/components/FlyingQuote.tsx:171 -- changed here
Sibling: website/src/apps/issue-radar/views/GraphView.tsx:248 -- changed here
Sibling: website/src/apps/issue-radar/views/GraphView.tsx:619 -- changed here
Sibling: website/src/apps/mochi/panel/approvalActions.ts:44 -- changed here
Sibling: website/src/pages/overview/MemoryRecordsEditor.tsx:24 -- changed here
Sibling: website/src/pages/chat/SubagentCompletionCard.tsx:47 -- changed here (the site #24727 lists; fixed with a TDD surrogate-pair test)
Sibling: website/src/components/chat-input/collapse.tsx:154 -- changed here
Sibling: website/src/components/WidgetFrame.tsx:302 -- changed here
Sibling: website/src/hooks/useAgentSync.ts:34 -- changed here
Sibling: website/src/hooks/useSceneInteraction.tsx:77 -- changed here
Sibling: website/src/hooks/themeCss.ts:603 -- changed here
Sibling: website/src/pages/overview/MemoryCarveCard.tsx:167 -- changed here
Sibling: website/src/apps/workflows/WorkflowRunTree.tsx:149 -- changed here
Sibling: website/src/lib/sessionTabs.ts:278 -- tracked in #24728
Sibling: website/src/utils/sessionRefs.ts:124 -- tracked in #24728
Sibling: website/src/utils/questionAnswers.ts:35 -- tracked in #24728
Sibling: website/src/pages/chat/TurnNavigationMinimap.tsx -- tracked in #24753
Sibling: website/src/pages/chat/MemoryRecallStrip.tsx:18 -- not affected -- clips a server-minted memory record id, not user or agent text
Sibling: website/src/components/WidgetFrame.tsx:294 -- not affected -- the 64-unit cut is a widget action id, not shown text, and the full id is kept when it is under the cap
Open PRs touch some of these files. #24710 (
feat(subagents): name unlabelled runs) rewrites theSubagentCompletionCard.tsxheadline line this PR fixes, keeping the same.slice(0, 120)bug; the fix is made here soCloses #24727is honest, and whichever lands second resolves a trivial conflict on that one line. Others touch changed files but not a changed line: #20757 (SubagentCompletionCard model-fallback, a different region), #10175 (WidgetFrame), #11100 (collapse), #16481 (useAgentSync, useSceneInteraction), #17525 / #19820 / #19824 (GraphView), #22674 (themeCss), #23854 (useSceneInteraction), #20493 (CommentOverlay, imported only).Pattern harvest
Rule candidate: lint
Pattern: a display string cut with
.slice(0, n)followed by an ellipsis, wherencan split a UTF-16 surrogate pair. It should go throughsliceCodePoints.Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.