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 <noreply@anthropic.com>
(cherry picked from commit 89b6d02481)
This commit is contained in:
Cássio Jones Dhein Silva
2026-04-21 08:53:36 -03:00
committed by Peter Steinberger
parent 9040cda408
commit 52d0a22d62

View File

@@ -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;