From d79b4146b242007c7bcb8d9cad2b34e72307b30e Mon Sep 17 00:00:00 2001 From: spoukyii <61633921+spoukyii@users.noreply.github.com> Date: Tue, 3 Nov 2026 12:41:49 -0800 Subject: [PATCH 1/2] test(client-runtime): expect a subagent preview cut at an emoji to keep no half of it --- packages/client-runtime/src/state/subagentDisplay.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/client-runtime/src/state/subagentDisplay.test.ts b/packages/client-runtime/src/state/subagentDisplay.test.ts index 5bdd434388ec6..9b1536a7aacb1 100644 --- a/packages/client-runtime/src/state/subagentDisplay.test.ts +++ b/packages/client-runtime/src/state/subagentDisplay.test.ts @@ -36,6 +36,6 @@ it("normalizes Unicode whitespace and ignores a large hidden suffix", () => { subagentDetailPreview({ status: "running", progress: "\uFEFF\u2029", result: " Done " }), ).toBe("Done"); expect(subagentDetailPreview({ status: "failed", result: "x".repeat(279) + "šŸ˜€" })).toBe( - "x".repeat(279) + "\uD83D…", + "x".repeat(279) + "…", ); }); From adf15a992b86fc7d9ecd9c2187305986dae0b9aa Mon Sep 17 00:00:00 2001 From: spoukyii <61633921+spoukyii@users.noreply.github.com> Date: Tue, 3 Nov 2026 12:42:06 -0800 Subject: [PATCH 2/2] fix(client-runtime): subagent previews no longer end in a broken character MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 #29158 added to context chip labels and #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 --- packages/client-runtime/src/state/subagentDisplay.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/client-runtime/src/state/subagentDisplay.ts b/packages/client-runtime/src/state/subagentDisplay.ts index 124c45e264f79..5f1a65fb8a22e 100644 --- a/packages/client-runtime/src/state/subagentDisplay.ts +++ b/packages/client-runtime/src/state/subagentDisplay.ts @@ -132,7 +132,15 @@ export function subagentDetailPreview(input: { if (compact.length > 0) compact += " "; } compact += detail[index]; - if (compact.length > 280) return `${compact.slice(0, 280).trimEnd()}…`; + if (compact.length > 280) { + let end = 280; + const previous = compact.charCodeAt(end - 1); + const next = compact.charCodeAt(end); + if (previous >= 0xd800 && previous <= 0xdbff && next >= 0xdc00 && next <= 0xdfff) { + end -= 1; + } + return `${compact.slice(0, end).trimEnd()}…`; + } } return compact || null; }