@devries-cameron20 / t3code Mirror · read-only / commits / fe199e35ca
Fork 0

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

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 22, 03:15 UTC

fix(client-runtime): untitled subagent titles no longer end in a broken character (#30390)

Co-authored-by: maria-rcks <maria@kuuro.net>

spoukyii committed Nov 5, 2026 at 20:43 UTC fe199e35cae53cf615063bc25a7c68e85cdaa9b7
2 files changed +19 -3
packages/client-runtime/src/state/subagentRuntime.test.ts
+7
@@ -158,6 +158,13 @@ describe("projectedSubagentsToRuntime workflow expansion", () => {
158 expect(members?.[0]?.speed).toBeUndefined();
159 },
160 );
161 +
162 + it("titles an untitled subagent from its prompt without splitting an emoji", () => {
163 + const [untitled] = projectedSubagentsToRuntime([
164 + subagent({ title: null, prompt: `${"a".repeat(76)}😀 and more work.` }),
165 + ]);
166 + expect(untitled?.title).toBe(`${"a".repeat(76)}...`);
167 + });
168 });
169
170 describe("deriveWorkflowGroups over a dynamic workflow", () => {
packages/client-runtime/src/state/subagentRuntime.ts
+12 -3
@@ -176,6 +176,17 @@ function workflowMembersToRuntime(
176 });
177 }
178
179 +function promptTitle(prompt: string): string {
180 + if (prompt.length <= 80) return prompt;
181 + let end = 77;
182 + const previous = prompt.charCodeAt(end - 1);
183 + const next = prompt.charCodeAt(end);
184 + if (previous >= 0xd800 && previous <= 0xdbff && next >= 0xdc00 && next <= 0xdfff) {
185 + end -= 1;
186 + }
187 + return `${prompt.slice(0, end)}...`;
188 +}
189 +
190 export function workflowMemberModelSelection(
191 member: Pick<RuntimeSubagent, "model" | "effort" | "speed">,
192 instanceId: ModelSelection["instanceId"],
@@ -216,9 +227,7 @@ export function projectedSubagentsToRuntime(
227 const coordinator = {
228 id: subagent.id,
229 kind: workflow === undefined ? "subagent" : "workflow",
219 - title:
220 - subagent.title ??
221 - (subagent.prompt.length > 80 ? `${subagent.prompt.slice(0, 77)}...` : subagent.prompt),
230 + title: subagent.title ?? promptTitle(subagent.prompt),
231 role: null,
232 model: subagent.model,
233 effort: null,