From aedf94c4a021b9f27c04d6ca1a8f931e0ea4870b Mon Sep 17 00:00:00 2001 From: xintaofei Date: Fri, 17 Apr 2026 14:40:12 +0800 Subject: [PATCH] fix(ui): suppress streaming Agent partial content to avoid duplicate prompt display --- src/contexts/conversation-runtime-context.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/contexts/conversation-runtime-context.tsx b/src/contexts/conversation-runtime-context.tsx index 35c581f..d68431c 100644 --- a/src/contexts/conversation-runtime-context.tsx +++ b/src/contexts/conversation-runtime-context.tsx @@ -448,12 +448,15 @@ function buildStreamingTurnsFromLiveMessage( // agent with child calls). Emit the running result so the renderer // can display live output / nested tool calls, and flag the // tool_call so the adapter keeps state="input-available". + // + // For Agents specifically, partial `content` from Claude Code's + // Task tool echoes the prompt (and subagent message fragments) + // before the real result arrives — suppress it so the Agent card + // doesn't duplicate the prompt already shown in the collapsible. currentBlocks.push({ type: "tool_result", tool_use_id: block.info.tool_call_id, - output_preview: isAgent - ? cleanAgentOutput(resolvedOutput) - : (resolvedOutput ?? null), + output_preview: isAgent ? null : (resolvedOutput ?? null), is_error: false, ...(agentStats ? { agent_stats: agentStats } : {}), })