Repository navigation
Conversation
…acter A subagent's progress or result preview is cut at 280 UTF-16 code units with "…" added. When an emoji straddled the cut, the preview kept only its high surrogate and showed a replacement character before the "…". The web subagent hover cards show the end of that preview. 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 and pingdotgg#29563 added to thread titles. The existing test had pinned the split half; it now expects the emoji dropped whole. Bug: a subagent preview ends in a broken character when an emoji sits at the 280-unit cut
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — Subagent previews avoid ending with half an emoji when truncated. The change is limited to display formatting, with no changes to stored data, product defaults, or external systems. You can add or adjust custom eligibility rules. Learn more. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
Note Written by Verified in a real dev environmentVerified unchanged head Ran A child returned 279 ASCII Also ran a fresh Codex parent/child turn on the PR head and checked the rendered preview text: The local proxy retried during two turns and recovered; all requested results completed. The fresh PR parent turn finished in 2m 20s. Blacksmith passed the existing Before, main: After, same app-created result on the PR: Fresh PR turn, opening the hover card: Inspected the captures and checked uploaded video playback and seeking in T3's browser. Not verifiedNative iOS/Android and the Electron shell were not exercised on this Linux web run. Other providers, workflow-specific hover entry points, and remote/tunnel connections were not exercised. Grapheme-cluster preservation is outside this change; this verifies surrogate-pair safety at the specified boundary. |



Problem
subagentDetailPreviewinpackages/client-runtime/src/state/subagentDisplay.tsbuilds a one-line preview of a subagent's progress or result. It trims leading whitespace, collapses whitespace runs, and cuts anything longer than 280 UTF-16 code units at 280 code units, then adds…. When an emoji straddles that cut, the slice keeps only the emoji's high surrogate (U+D83D for 😀). The preview then ends in a replacement character (�) right before the…, where it should end on the last whole character before the emoji.Where the broken end shows:
SubagentTooltipContent). It shows the preview throughMiddleTruncate, which always keeps the last 10 code points in ashrink-0span, so the � stays visible. The card opens from subagent rows in the chat timeline (V2LifecycleRow), the thread relationships panel (ThreadRelationshipsControl), workflow member rows (ThreadLineageWorkflowRow) and the workflow opening block (WorkflowOpeningBlock).Where it is clipped, so it looks the same before and after this fix:
numberOfLines={1}(ThreadWorkflowGroup.tsx), so its end never shows.numberOfLines={3}(SubagentRow.tsx). Its end shows only when the whole preview fits in three lines, which takes over 90 characters per line, so not on a phone.Expected: the cut never splits a surrogate pair, as in the context chip labels #29158 fixed.
Change
When the 280-code-unit cut would land between a high and a low surrogate, it steps back one code unit, so the emoji is dropped whole. This is the same check #29158 added to context chip labels and #29563 added to
t3 thread starttitles. The 280-code-unit limit, the whitespace collapsing, the…suffix and every preview that does not split a pair are unchanged.The cut still works per code point, not per grapheme cluster. A multi-code-point emoji, such as a flag, a skin-tone modifier or a ZWJ family, can still be split between its code points. It never leaves a lone surrogate. That matches the precedents.
The existing test already had a case with an emoji on the cut, added by perf PR #21277, and it expected the lone high surrogate. That was pinned old behaviour, not a choice. #21277's body says: "Selection priority, whitespace collapsing, trailing-space handling, ellipsis, null fallback, and the existing UTF-16 truncation boundary are retained." Its goal was output equal to the old code's, so it pinned the split. The case now expects the emoji dropped whole.
The shared
truncateinpackages/sharedis not used here. #24611 (open) fixes the same split in it, but this function does not call it, and its arithmetic differs: it trims, cuts at the limit and adds...(three dots), while this preview keeps its own whitespace handling and adds…(one character), so switching would change the preview's text and length.Scope and approval
This is a very small, focused fix for an obvious bug, so there is no prior issue. It is the defect #29158 ("context chip labels no longer split an emoji at the 200-character cap") and #29563 ("t3 thread start titles no longer end in a broken character") fixed elsewhere, still present in the shared subagent preview. It applies their check and changes no other behaviour, setting or contract.
Overlap check, by
subagentDetailPreviewand by file. #17420, #21643 and #27034 touchsubagentDisplay.ts, but none changessubagentDetailPreview's cut. #29637 changes how the timeline row cleans a subagent preview, inV2LifecycleRow.logic.ts, not this cut. #24611 changes the sharedtruncate, which this function does not call.Verification
packages/client-runtime/src/state/subagentDisplay.test.tsalready projects a failed subagent whose result is 279 ASCII characters followed by😀, so the emoji sits on the cut. Its expected value changes from the 279 characters, the lone high surrogate U+D83D and…to the 279 characters and….On
mainwith only the test commit (d79b414), frompackages/client-runtime,vp test run src/state/subagentDisplay.test.ts:In words: on
mainthe preview is the 279 ASCII characters, the lone high surrogate U+D83D, then…. With the fix it is the 279 ASCII characters, then….With the fix:
vp test run src/state/subagentDisplay.test.tsinpackages/client-runtime: 5 passed.vp run check:changedfrom the repo root: format, lint, knip, typecheck (7 packages) and tests (2 files) all pass.To see it on web: in a thread whose agent ran a subagent, let the subagent report a result longer than 280 characters whose first 279 characters are ASCII with no whitespace runs, followed by an emoji and more text. The preview trims leading whitespace and collapses whitespace runs before it counts, so count after that. Hover the subagent's row in the chat timeline. On
mainthe hover card's preview line ends in � before the…. With the fix it ends in….What I could not check: the hover card in a running app. The test covers the preview function every surface above renders.
Bug: a subagent preview ends in a broken character when an emoji sits at the 280-unit cut
This was written with Claude Opus 5.5 in Claude Code, driven from T3 Code.