From da7f4b8542e5414844c3c15a954d9f82afa0e869 Mon Sep 17 00:00:00 2001 From: spoukyii <61633921+spoukyii@users.noreply.github.com> Date: Tue, 3 Nov 2026 12:14:27 -0800 Subject: [PATCH 1/2] test(provider-core): cover a long background work label that ends on an emoji --- packages/provider-core/src/server/notification.test.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/provider-core/src/server/notification.test.ts b/packages/provider-core/src/server/notification.test.ts index cab8ed06a64c6..272cd007632a2 100644 --- a/packages/provider-core/src/server/notification.test.ts +++ b/packages/provider-core/src/server/notification.test.ts @@ -42,6 +42,12 @@ describe("backgroundWorkNotification", () => { .summary, 'Monitor "Three ticks" reported new output', ); + assert.equal( + backgroundWorkNotification([ + { kind: "command", label: `${"a".repeat(78)}😀 and more`, outcome: "completed" }, + ]).summary, + `Command "${"a".repeat(78)}…" finished`, + ); }); it("names every piece of work that ended together, without opening one of them", () => { From f1811c3b34e1666c8b10a8e3c9bb15f667a795ef Mon Sep 17 00:00:00 2001 From: spoukyii <61633921+spoukyii@users.noreply.github.com> Date: Tue, 3 Nov 2026 12:14:44 -0800 Subject: [PATCH 2/2] fix(provider-core): background work notices no longer end in a broken character reportLabel cut a subagent, command, monitor or delegated task label at 79 UTF-16 code units before adding an ellipsis. When an emoji straddled the cut, the label kept only its high surrogate, so the notice the thread shows when that work finishes or asks a question ended in a replacement character before the ellipsis. Each notice is stored with the thread, so the broken character stayed for good. The cut now steps back one unit when it would land between a high and a low surrogate, the same check #29163 and #29563 added to thread titles. Bug: a background work notice ends in a broken character when an emoji sits at the label cut --- packages/provider-core/src/server/notification.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/provider-core/src/server/notification.ts b/packages/provider-core/src/server/notification.ts index 85cac547cfa37..55b1125fd9448 100644 --- a/packages/provider-core/src/server/notification.ts +++ b/packages/provider-core/src/server/notification.ts @@ -25,9 +25,14 @@ const LABEL_MAX_LENGTH = 80; export function reportLabel(label: string | undefined): string | undefined { const firstLine = label?.trim().split("\n")[0]?.trim(); if (firstLine === undefined || firstLine.length === 0) return undefined; - return firstLine.length > LABEL_MAX_LENGTH - ? `${firstLine.slice(0, LABEL_MAX_LENGTH - 1)}…` - : firstLine; + if (firstLine.length <= LABEL_MAX_LENGTH) return firstLine; + let end = LABEL_MAX_LENGTH - 1; + const previous = firstLine.charCodeAt(end - 1); + const next = firstLine.charCodeAt(end); + if (previous >= 0xd800 && previous <= 0xdbff && next >= 0xdc00 && next <= 0xdfff) { + end -= 1; + } + return `${firstLine.slice(0, end)}…`; } const KIND_NOUN: Record = {