From dc3c7336123802f6a83302ff539fa84c4cc6086a Mon Sep 17 00:00:00 2001 From: user Date: Sun, 11 Jan 2026 05:52:33 +0000 Subject: [PATCH] fix(agent): use session key agentId for transcript path Cross-agent subagent spawns wrote transcripts to the spawner's agent directory instead of the target agent's directory. For example, when main spawned a codex subagent with session key agent:codex:subagent:..., the transcript went to agents/main/sessions/ instead of agents/codex/sessions/. Pass sessionAgentId to resolveSessionFilePath so transcripts are written to the correct agent's session directory. --- src/commands/agent.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/commands/agent.ts b/src/commands/agent.ts index b7d2ea448..77fb4d942 100644 --- a/src/commands/agent.ts +++ b/src/commands/agent.ts @@ -416,7 +416,9 @@ export async function agentCommand( catalog: catalogForThinking, }); } - const sessionFile = resolveSessionFilePath(sessionId, sessionEntry); + const sessionFile = resolveSessionFilePath(sessionId, sessionEntry, { + agentId: sessionAgentId, + }); const startedAt = Date.now(); let lifecycleEnded = false;