BUG: Subagent assistant message deltas don't include parentToolCallId
** Summary**
When a subagent is spawned via the task() tool, streaming assistant.message_delta events do not include parentToolCallId. Only the final assistant.message event carries it. This makes it impossible for SDK consumers to attribute streaming deltas to the correct subagent in real time.
Expected behavior
assistant.message_delta events emitted during a subagent turn should include parentToolCallId (the tool call ID of the task() invocation that spawned the subagent), matching the behavior of the final assistant.message event.
Actual behavior
The single emit site for assistant.message_delta only passes { messageId, deltaContent }:
// index.js (bundled CLI) — only emit site for assistant.message_delta this.session.emitEphemeral("assistant.message_delta", { messageId: this.currentMessageId, deltaContent: n });
Meanwhile, the final message correctly includes it:
this.emit("assistant.message", { parentToolCallId: Q, messageId: mi(), content: ... });
The session event schema already defines parentToolCallId as optional on assistant.message_delta:
// generated/session-events.ts type: "assistant.message_delta", data: { messageId: string; deltaContent: string; parentToolCallId?: string; // ← defined but never populated }
Reproduction
- Create a session with the SDK that has access to the task agent type
- Send a prompt that triggers a task() tool call (subagent delegation)
- Observe assistant.message_delta events — parentToolCallId is undefined
- Observe the final assistant.message — parentToolCallId is correctly set
SDK: 0.1.32 CLI: 1.0.2
+1 confirming on Node.js SDK 0.1.33-preview.0, CLI 1.0.5
we build an observability layer (Langfuse tracing) on top of session events and hit this exact issue: assistant.message_delta events from sub-agents spawned via task() have no parentToolCallId, so we can't attribute streaming content to the correct sub-agent span in real time
we have to wait for the final assistant.message and reconcile retroactively, which defeats the purpose of streaming observability
Generated by Copilot.
I believe this has already been fixed/addressed.
Fix summary: Sub-agent assistant message deltas now include the parent tool-call association needed by SDK consumers.
Closing this as completed.