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 <cursoragent@cursor.com>
This commit is contained in:
kumarabhirup 2026-02-22 00:15:33 -08:00
parent b29b2e39a3
commit 32cfcf14fa
No known key found for this signature in database
GPG Key ID: DB7CA2289CAB0167

View File

@ -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<string, unknown> | undefined)?.args
? ((spawnArgs as Record<string, unknown>).args as Record<string, unknown>)?.task as string | undefined
: undefined;
const spawnLabel =
result?.details?.label as string | undefined;
(spawnArgs as Record<string, unknown> | undefined)?.args
? ((spawnArgs as Record<string, unknown>).args as Record<string, unknown>)?.label as string | undefined
: undefined;
if (childSessionKey && childRunId) {
registerSubagent(run.sessionId, {
sessionKey: childSessionKey,