From 78fe3e4df345fdc7c8d61728fb236c4cc6096592 Mon Sep 17 00:00:00 2001 From: Mohamed Boudra Date: Mon, 4 May 2026 10:13:44 +0700 Subject: [PATCH] Drop subagent task notifications from parent timeline Subagent task_notification system messages arrive without parent_tool_use_id but with tool_use_id pointing at the parent's Task call, so they slip past the sidechain router and render as top-level "Task Notification" rows in the parent's timeline. Skip them when the referenced tool_use is a Task call; parent-level background bash notifications still flow through. --- .../server/src/server/agent/providers/claude-agent.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/server/src/server/agent/providers/claude-agent.ts b/packages/server/src/server/agent/providers/claude-agent.ts index 38c90daa5..74efbdf6d 100644 --- a/packages/server/src/server/agent/providers/claude-agent.ts +++ b/packages/server/src/server/agent/providers/claude-agent.ts @@ -2975,6 +2975,16 @@ class ClaudeAgentSession implements AgentSession { return; } if (message.subtype === "task_notification") { + // TODO: subagent timelines are best-effort. Subagent task_notifications + // arrive without parent_tool_use_id but with tool_use_id pointing at the + // parent's Task call, so they slip past the sidechain router and pollute + // the parent timeline. Drop them here; eventually thread them into the + // parent Task tool call's sub_agent log instead. + const taskUseId = message.tool_use_id; + const cachedTool = taskUseId ? this.toolUseCache.get(taskUseId) : undefined; + if (cachedTool?.name === "Task") { + return; + } const taskNotificationItem = mapTaskNotificationSystemRecordToToolCall(message); if (taskNotificationItem) { events.push({