The best way to control Claude Code, Codex and more from any computer or phone
fix(client-runtime): subagent previews no longer end in a broken character (#30391)
spoukyii committed
Nov 5, 2026 at 20:27 UTC
6f51361a279f3d04d36f11cacbc69072c15083d2
2 files changed
+10
-2
packages/client-runtime/src/state/subagentDisplay.test.ts
+1
-1
@@ -36,6 +36,6 @@ it("normalizes Unicode whitespace and ignores a large hidden suffix", () => {
36
subagentDetailPreview({ status: "running", progress: "\uFEFF\u2029", result: " Done " }),
37
).toBe("Done");
38
expect(subagentDetailPreview({ status: "failed", result: "x".repeat(279) + "😀" })).toBe(
39
- "x".repeat(279) + "\uD83D…",
39
+ "x".repeat(279) + "…",
40
);
41
});
packages/client-runtime/src/state/subagentDisplay.ts
+9
-1
@@ -134,7 +134,15 @@ export function subagentDetailPreview(input: {
134
if (compact.length > 0) compact += " ";
135
}
136
compact += detail[index];
137
- if (compact.length > 280) return `${compact.slice(0, 280).trimEnd()}…`;
137
+ if (compact.length > 280) {
138
+ let end = 280;
139
+ const previous = compact.charCodeAt(end - 1);
140
+ const next = compact.charCodeAt(end);
141
+ if (previous >= 0xd800 && previous <= 0xdbff && next >= 0xdc00 && next <= 0xdfff) {
142
+ end -= 1;
143
+ }
144
+ return `${compact.slice(0, end).trimEnd()}…`;
145
+ }
146
}
147
return compact || null;
148
}