@devries-cameron20 / t3code-1 / commits / 151c241cd2
Fork 0

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

fix(client-runtime): format subagent descriptions as display names (#14999)

Yash Singh committed Oct 2, 2026 at 23:11 UTC 151c241cd2cc22c3b10ba8735e44f83fb723a511
2 files changed +50 -2
packages/client-runtime/src/state/threadExecution.test.ts
+43
@@ -478,6 +478,49 @@ describe("threadRuntimeCanArchive", () => {
478 });
479
480 describe("presentPendingBackgroundWork", () => {
481 + it.each(["Subagent:", "Subagent: "])(
482 + "falls back to the subagent noun when %s has no display name",
483 + (description) => {
484 + const presentation = presentPendingBackgroundWork([
485 + { taskId: "unnamed", kind: "subagent", description },
486 + ]);
487 +
488 + expect(presentation?.title).toBe("Waiting on a subagent");
489 + expect(presentation?.items[0]?.label).toBe("subagent");
490 + },
491 + );
492 +
493 + it.each([
494 + "/root/luna_window_properties",
495 + "Subagent: /root/luna_window_properties",
496 + "/root/parent/luna_window_properties",
497 + ])("uses the subagent display name for %s", (description) => {
498 + const childThreadId = ThreadId.make("thread:luna");
499 + const presentation = presentPendingBackgroundWork([
500 + { taskId: "luna", kind: "subagent", description, childThreadId },
501 + ]);
502 +
503 + expect(presentation).toEqual({
504 + title: "Waiting on subagent Luna Window Properties",
505 + items: [{ taskId: "luna", kind: "subagent", label: "Luna Window Properties", childThreadId }],
506 + });
507 + });
508 +
509 + it("formats subagent names in a mixed roster and preserves command descriptions", () => {
510 + const presentation = presentPendingBackgroundWork([
511 + { taskId: "cmd", kind: "command", description: "/root/run_tests" },
512 + { taskId: "luna", kind: "subagent", description: "/root/luna_window_properties" },
513 + { taskId: "review", kind: "subagent", description: "Review src/math.ts" },
514 + ]);
515 +
516 + expect(presentation?.title).toBe("Waiting on 2 subagents and 1 command");
517 + expect(presentation?.items.map((item) => item.label)).toEqual([
518 + "Luna Window Properties",
519 + "Review src/math.ts",
520 + "/root/run_tests",
521 + ]);
522 + });
523 +
524 it("names a single piece of work by kind", () => {
525 expect(
526 presentPendingBackgroundWork([
packages/client-runtime/src/state/threadExecution.ts
+7 -2
@@ -25,6 +25,7 @@ import {
25 type ThreadRunSummary,
26 type ThreadRuntimeSummary,
27 } from "./models.ts";
28 +import { formatSubagentDisplayTitle } from "./subagentDisplay.ts";
29
30 const ACTIVITY_RUN_STATUSES = new Set(["preparing", "starting", "running", "waiting"]);
31 const INTERRUPTIBLE_RUN_STATUSES = new Set(["preparing", "starting", "running"]);
@@ -295,13 +296,17 @@ export function presentPendingBackgroundWork(
296 const items = tasks
297 .map((task): PendingBackgroundWorkItem => {
298 const description = task.description?.trim();
299 + const label =
300 + task.kind === "subagent" && description !== undefined
301 + ? formatSubagentDisplayTitle(description).trim()
302 + : description;
303 return {
304 taskId: task.taskId,
305 kind: task.kind,
306 label:
302 - description === undefined || description.length === 0
307 + label === undefined || label.length === 0
308 ? BACKGROUND_WORK_KINDS[task.kind].singular
304 - : description,
309 + : label,
310 childThreadId: task.kind === "subagent" ? task.childThreadId : undefined,
311 };
312 })