@devries-cameron20 / t3code Mirror · read-only / commits / 447c0129cc
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 21, 07:15 UTC

fix(claude): a background subagent's shell shows its command in Background work details (#38904)

Co-authored-by: Julius Marminge <julius0216@outlook.com>

Noah Sigel committed Nov 18, 2026 at 21:32 UTC 447c0129cce69b4be5d594328e19f14ab4830e2e
2 files changed +45 -2
apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts
+42
@@ -18333,6 +18333,13 @@ describe("ClaudeAdapterV2 background wake turns", () => {
18333 uuid: "00000000-0000-4000-8000-000000000952",
18334 bashToolUseId: STRADDLING_BASH,
18335 }),
18336 + claudeSdkFrame({
18337 + type: "system",
18338 + subtype: "background_tasks_changed",
18339 + tasks: [{ task_id: TASK_ID, task_type: "local_agent", description: "Audit" }],
18340 + uuid: "00000000-0000-4000-8000-000000000961",
18341 + session_id: WAKE_NATIVE_SESSION,
18342 + }),
18343 makeResultFrame({
18344 uuid: "00000000-0000-4000-8000-000000000953",
18345 result: "Auditing in the background.",
@@ -18376,6 +18383,41 @@ describe("ClaudeAdapterV2 background wake turns", () => {
18383 event.subagent.progress === "Reading the last commits",
18384 ),
18385 );
18386 + // The subagent backgrounds that shell; Claude names it by its command alone.
18387 + yield* Queue.offer(
18388 + harness.sdkMessages,
18389 + claudeSdkFrame({
18390 + type: "system",
18391 + subtype: "task_started",
18392 + task_id: "idle-shell",
18393 + tool_use_id: IDLE_BASH,
18394 + description: "git log -5",
18395 + is_backgrounded: true,
18396 + parent_task_id: TASK_ID,
18397 + task_type: "local_bash",
18398 + uuid: "00000000-0000-4000-8000-000000000960",
18399 + session_id: WAKE_NATIVE_SESSION,
18400 + }),
18401 + );
18402 + yield* harness.until(() =>
18403 + harness.events.some(
18404 + (event) =>
18405 + event.type === "provider_thread.updated" &&
18406 + event.providerThread.pendingBackgroundTasks?.some(
18407 + (task) => task.taskId === "idle-shell",
18408 + ) === true,
18409 + ),
18410 + );
18411 + const idleShell = latestToolItem(IDLE_BASH);
18412 + assert.deepInclude(
18413 + harness.events
18414 + .findLast((event) => event.type === "provider_thread.updated")
18415 + ?.providerThread.pendingBackgroundTasks?.find((task) => task.taskId === "idle-shell"),
18416 + {
18417 + command: "git log -5",
18418 + itemId: idleShell?.type === "turn_item.updated" ? idleShell.turnItem.id : undefined,
18419 + },
18420 + );
18421 const routing = subagentRouting(harness.events, [STRADDLING_BASH, IDLE_BASH]);
18422 assert.deepEqual(routing.assistantTexts(routing.childThreadId), ["Still auditing."]);
18423 const straddling = latestToolItem(STRADDLING_BASH);
apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts
+3 -2
@@ -10274,10 +10274,11 @@ export const makeClaudeAdapterV2 = Effect.fn("makeClaudeAdapterV2")(function* (
10274 activeContext: ActiveClaudeTurnContext | null,
10275 toolUseId: string | undefined,
10276 ): Pick<OrchestrationV2PendingBackgroundTask, "command" | "itemId" | "sourceThreadId"> => {
10277 + // A background subagent keeps launching shells after the root turn settles.
10278 const launch =
10278 - toolUseId === undefined || activeContext === null
10279 + toolUseId === undefined
10280 ? undefined
10280 - : findToolCall(activeContext, toolUseId);
10281 + : (activeContext?.toolCalls.get(toolUseId) ?? subagentToolCalls.get(toolUseId));
10282 const command =
10283 launch?.classification.itemType === "command_execution" ||
10284 launch?.toolName === "Monitor"