From af3a42a00e358c4c195753f5a016a1c8a7f12d62 Mon Sep 17 00:00:00 2001 From: Jiang Bohan Date: Wed, 11 Feb 2026 18:58:32 +0800 Subject: [PATCH] fix(subagent): forward announcement summary to UI stream Changed forwardAssistant from false to true in sendAnnounceDirect() so the assistant's summary response is streamed to the desktop UI in real-time. The announcement prompt stays internal (hidden from UI), but the user now sees the completion notification. Previously, persistAssistantSummary saved the response to JSONL but never emitted events to the UI subscriber, leaving users with no visible feedback after subagent tasks completed. Co-Authored-By: Claude Opus 4.6 --- packages/core/src/agent/subagent/announce.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/core/src/agent/subagent/announce.ts b/packages/core/src/agent/subagent/announce.ts index 3532d1af..c1cf3330 100644 --- a/packages/core/src/agent/subagent/announce.ts +++ b/packages/core/src/agent/subagent/announce.ts @@ -281,10 +281,10 @@ export function formatCoalescedAnnouncementMessage( * later drain via writeInternal (with debounce to batch nearby completions) * 2. Direct — if parent is idle, send immediately via writeInternal * - * All delivery uses writeInternal() which marks entries as `internal: true`, - * preventing announcement messages from showing as user bubbles in the UI. - * We avoid steer() (cancels unrelated tool calls) and followUp() (doesn't - * mark entries as internal, polluting the chat UI). + * All delivery uses writeInternal() which marks the announcement prompt as + * `internal: true` (hidden from UI). The assistant's summary response is + * forwarded to the real-time stream (`forwardAssistant: true`) so the user + * sees the result, and persisted to JSONL for future session loads. */ export function runCoalescedAnnounceFlow( requesterSessionId: string, @@ -345,7 +345,7 @@ function sendAnnounceDirect(requesterSessionId: string, message: string): void { ); return; } - parentAgent.writeInternal(message, { forwardAssistant: false, persistResponse: true }); + parentAgent.writeInternal(message, { forwardAssistant: true, persistResponse: true }); } catch (err) { console.error(`[SubagentAnnounce] Failed direct announce to parent:`, err); } @@ -391,7 +391,7 @@ export function runSubagentAnnounceFlow(params: SubagentAnnounceParams): boolean return false; } - parentAgent.writeInternal(message, { forwardAssistant: false, persistResponse: true }); + parentAgent.writeInternal(message, { forwardAssistant: true, persistResponse: true }); return true; } catch (err) { console.error(`[SubagentAnnounce] Failed to announce to parent:`, err);