@devries-cameron20 / t3code-1 / commits / 86b7dc6bfa
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(provider-core): long subagent titles no longer end in a broken character (#29906)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Alex Southwell committed Nov 3, 2026 at 23:42 UTC 86b7dc6bfa12123abef683811c852ec320537690
2 files changed +21 -2
packages/provider-core/src/server/subagentProjection.test.ts new
+13
@@ -0,0 +1,13 @@
1 +import { describe, expect, it } from "vite-plus/test";
2 +
3 +import { subagentThreadTitle } from "./subagentProjection.ts";
4 +
5 +describe("subagentThreadTitle", () => {
6 + it("clips a long prompt without splitting a surrogate pair", () => {
7 + const title = (prompt: string) =>
8 + subagentThreadTitle({ parentTitle: "Parent", prompt, ordinal: 1 });
9 +
10 + expect(title(`${"a".repeat(68)}😀 and more work.`)).toBe(`${"a".repeat(68)}...`);
11 + expect(title(`${"a".repeat(67)}😀 and more work.`)).toBe(`${"a".repeat(67)}😀...`);
12 + });
13 +});
packages/provider-core/src/server/subagentProjection.ts
+8 -2
@@ -39,8 +39,14 @@ export function subagentThreadTitle(input: {
39 if (detail === undefined) {
40 return `${input.parentTitle} subagent ${input.ordinal}`;
41 }
42 - const clipped = detail.length > 72 ? `${detail.slice(0, 69)}...` : detail;
43 - return clipped;
42 + if (detail.length <= 72) return detail;
43 + let end = 69;
44 + const previous = detail.charCodeAt(end - 1);
45 + const next = detail.charCodeAt(end);
46 + if (previous >= 0xd800 && previous <= 0xdbff && next >= 0xdc00 && next <= 0xdfff) {
47 + end -= 1;
48 + }
49 + return `${detail.slice(0, end)}...`;
50 }
51
52 export function makeSubagentChildThread(input: {