From 89b6d0248159c2357b1e151e00c6e30396ee02f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A1ssio=20Jones=20Dhein=20Silva?= <144484257+CCcassiusdjs@users.noreply.github.com> Date: Tue, 21 Apr 2026 08:53:36 -0300 Subject: [PATCH] fix(tui): arm streaming watchdog on every delta, not only visible ones (#69338) When ingestDelta returns null (first empty/commentary delta or unchanged content), the handler returned early, skipping setActivityStatus and armStreamingWatchdog. If all subsequent deltas were also null (e.g. due to phase filtering), the watchdog was never armed and the status bar stayed stale as "idle" while a run was live. Move setActivityStatus("streaming") and armStreamingWatchdog before the null-displayText guard so they fire on every received delta event. Fixes #34513, #40824 Co-authored-by: Claude Sonnet 4.6 --- src/tui/tui-event-handlers.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/tui/tui-event-handlers.ts b/src/tui/tui-event-handlers.ts index b503801d8dc..8ac9262bcc8 100644 --- a/src/tui/tui-event-handlers.ts +++ b/src/tui/tui-event-handlers.ts @@ -298,15 +298,18 @@ export function createEventHandlers(context: EventHandlerContext) { } } if (evt.state === "delta") { + // Arm watchdog and mark streaming on every delta, even when the visible + // text hasn't changed yet (e.g. first commentary-only or tool-call delta). + // Without this, the watchdog never fires and the status bar stays stale. + setActivityStatus("streaming"); + if (state.activeChatRunId === evt.runId) { + armStreamingWatchdog(evt.runId); + } const displayText = streamAssembler.ingestDelta(evt.runId, evt.message, state.showThinking); if (!displayText) { return; } chatLog.updateAssistant(displayText, evt.runId); - setActivityStatus("streaming"); - if (state.activeChatRunId === evt.runId) { - armStreamingWatchdog(evt.runId); - } } if (evt.state === "final") { const isLocalBtwRun = isLocalBtwRunId?.(evt.runId) ?? false;