From 32cfcf14fa837894db6e77db628524171867039a Mon Sep 17 00:00:00 2001 From: kumarabhirup Date: Sun, 22 Feb 2026 00:15:33 -0800 Subject: [PATCH] fix(web): use correct field name childSessionKey in sessions_spawn registration The spawn tool result uses `childSessionKey` (not `sessionKey`), and task/label come from the tool input args, not the result details. Without this fix registerSubagent was never called because the extracted sessionKey was always undefined. Co-authored-by: Cursor --- apps/web/lib/active-runs.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/apps/web/lib/active-runs.ts b/apps/web/lib/active-runs.ts index dd82d13667d..55013010088 100644 --- a/apps/web/lib/active-runs.ts +++ b/apps/web/lib/active-runs.ts @@ -718,13 +718,21 @@ function wireChildProcess(run: ActiveRun): void { if (toolName === "sessions_spawn" && !isError) { const childSessionKey = - result?.details?.sessionKey as string | undefined; + result?.details?.childSessionKey as string | undefined; const childRunId = result?.details?.runId as string | undefined; + // task/label are in the tool input args, not the result + const spawnArgs = accToolMap.has(toolCallId) + ? run.accumulated.parts[accToolMap.get(toolCallId)!] + : undefined; const spawnTask = - result?.details?.task as string | undefined; + (spawnArgs as Record | undefined)?.args + ? ((spawnArgs as Record).args as Record)?.task as string | undefined + : undefined; const spawnLabel = - result?.details?.label as string | undefined; + (spawnArgs as Record | undefined)?.args + ? ((spawnArgs as Record).args as Record)?.label as string | undefined + : undefined; if (childSessionKey && childRunId) { registerSubagent(run.sessionId, { sessionKey: childSessionKey,