diff --git a/src/auto-reply/reply/agent-runner-execution.ts b/src/auto-reply/reply/agent-runner-execution.ts index c25342e4a28..e88c227d0a1 100644 --- a/src/auto-reply/reply/agent-runner-execution.ts +++ b/src/auto-reply/reply/agent-runner-execution.ts @@ -394,11 +394,17 @@ export async function runAgentTurnWithFallback(params: { await params.opts?.onToolStart?.({ name, phase }); } } - // Track auto-compaction completion and notify UI layer. + // Track auto-compaction and notify higher layers. if (evt.stream === "compaction") { const phase = typeof evt.data.phase === "string" ? evt.data.phase : ""; if (phase === "start") { - await params.opts?.onCompactionStart?.(); + if (params.opts?.onCompactionStart) { + await params.opts.onCompactionStart(); + } else { + // Use the universal in-run block reply path so every + // channel sees a notice while compaction is pausing the run. + await params.opts?.onBlockReply?.({ text: "🧹 Compacting context..." }); + } } const completed = evt.data?.completed === true; if (phase === "end" && completed) { diff --git a/src/auto-reply/reply/agent-runner.ts b/src/auto-reply/reply/agent-runner.ts index fbdad1be160..fba204eccad 100644 --- a/src/auto-reply/reply/agent-runner.ts +++ b/src/auto-reply/reply/agent-runner.ts @@ -697,8 +697,16 @@ export async function runReplyAgent(params: { }); } + // Always notify the user when compaction completes — not just in verbose + // mode. The "🧹 Compacting context..." notice was already sent at start, + // so the completion message closes the loop for every user regardless of + // their verbose setting. + const suffix = typeof count === "number" ? ` (count ${count})` : ""; + verboseNotices.push({ text: `✅ Context compacted${suffix}.` }); if (verboseEnabled) { - const suffix = typeof count === "number" ? ` (count ${count})` : ""; + // Verbose mode already gets the completion — keep the legacy notice + // text only for verbose so power users see the traditional wording. + verboseNotices.pop(); verboseNotices.push({ text: `🧹 Auto-compaction complete${suffix}.` }); } }