The best way to control Claude Code, Codex and more from any computer or phone
fix(provider-core): background work notices no longer end in a broken character (#30369)
spoukyii committed
Nov 5, 2026 at 20:26 UTC
94690956fd8f06ef302dd3fb9d4b1babba2a296c
2 files changed
+14
-3
packages/provider-core/src/server/notification.test.ts
+6
@@ -42,6 +42,12 @@ describe("backgroundWorkNotification", () => {
42
.summary,
43
'Monitor "Three ticks" reported new output',
44
);
45
+ assert.equal(
46
+ backgroundWorkNotification([
47
+ { kind: "command", label: `${"a".repeat(78)}😀 and more`, outcome: "completed" },
48
+ ]).summary,
49
+ `Command "${"a".repeat(78)}…" finished`,
50
+ );
51
});
52
53
it("names every piece of work that ended together, without opening one of them", () => {
packages/provider-core/src/server/notification.ts
+8
-3
@@ -25,9 +25,14 @@ const LABEL_MAX_LENGTH = 80;
25
export function reportLabel(label: string | undefined): string | undefined {
26
const firstLine = label?.trim().split("\n")[0]?.trim();
27
if (firstLine === undefined || firstLine.length === 0) return undefined;
28
- return firstLine.length > LABEL_MAX_LENGTH
29
- ? `${firstLine.slice(0, LABEL_MAX_LENGTH - 1)}…`
30
- : firstLine;
28
+ if (firstLine.length <= LABEL_MAX_LENGTH) return firstLine;
29
+ let end = LABEL_MAX_LENGTH - 1;
30
+ const previous = firstLine.charCodeAt(end - 1);
31
+ const next = firstLine.charCodeAt(end);
32
+ if (previous >= 0xd800 && previous <= 0xdbff && next >= 0xdc00 && next <= 0xdfff) {
33
+ end -= 1;
34
+ }
35
+ return `${firstLine.slice(0, end)}…`;
36
}
37
38
const KIND_NOUN: Record<BackgroundWork["kind"], readonly [string, string]> = {