The Claude Agent SDK forwards subagent assistant messages into the parent query stream tagged with parent_tool_use_id. The adapter already honored that attribution for tool uses (ensureToolCallStarted) but the assistant-text path ignored it, so every streamed subagent narration and final answer projected as parent-thread assistant prose — interleaved across concurrent subagents and duplicating the summary the child thread receives via task_notification. Assistant text now resolves the same subagentsByToolUseId registry and lands in the subagent's child thread. The child-thread result message becomes a fallback for streams that were never forwarded: once a subagent has streamed text since (re)open, the task_notification summary no longer re-emits as a duplicate child message (the parent subagent card still carries task.result). Attributed text whose registry lookup misses is dropped with a warning instead of leaking into the parent transcript. Subagent text dedupes against a per-subagent set rather than the parent turn's emittedNativeItemIds, which gates the parent fallback-text emission and must not be suppressed by subagent traffic. Co-Authored-By: Claude Fable 5 <[email protected]>
Server
Node.js WebSocket server for the T3 Code app.