Skip to content

Commit 0eba920

Browse files
author
Joseph Pruitt
committed
fix(tui): raise streaming watchdog threshold to 120s and suppress false-positive warning
The TUI streaming watchdog was set to 30 seconds, which triggers false-positive 'no stream updates' warnings during healthy long-running agent turns (tool calls, sub-agent work, code generation, browser automation). The alarming message ('backend may have dropped this run') caused unnecessary user confusion. Changes: - Raise DEFAULT_STREAMING_WATCHDOG_MS from 30s to 120s - Suppress the user-visible chatLog.addSystem() warning - Internal reset behavior is fully preserved (activeChatRunId cleared, activityStatus set to idle, render requested) - The override context.streamingWatchdogMs still works for custom values - Update tests to match suppressed message behavior
1 parent 64089fd commit 0eba920

2 files changed

Lines changed: 10 additions & 8 deletions

File tree

src/tui/tui-event-handlers.test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -721,7 +721,8 @@ describe("tui-event-handlers: streaming watchdog", () => {
721721

722722
expect(setActivityStatus).toHaveBeenLastCalledWith("idle");
723723
expect(state.activeChatRunId).toBeNull();
724-
expect(chatLog.addSystem).toHaveBeenCalledWith(expect.stringContaining("streaming watchdog"));
724+
/* Message is now suppressed — only the internal reset fires */
725+
expect(chatLog.addSystem).not.toHaveBeenCalled();
725726

726727
handlers.dispose?.();
727728
});
@@ -847,7 +848,8 @@ describe("tui-event-handlers: streaming watchdog", () => {
847848

848849
expect(setActivityStatus).toHaveBeenLastCalledWith("idle");
849850
expect(state.activeChatRunId).toBeNull();
850-
expect(chatLog.addSystem).toHaveBeenCalledTimes(2);
851+
/* Messages are now suppressed — only the internal reset fires */
852+
expect(chatLog.addSystem).not.toHaveBeenCalled();
851853

852854
handlers.dispose?.();
853855
});

src/tui/tui-event-handlers.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ type EventHandlerContext = {
4545
streamingWatchdogMs?: number;
4646
};
4747

48-
const DEFAULT_STREAMING_WATCHDOG_MS = 30_000;
48+
const DEFAULT_STREAMING_WATCHDOG_MS = 120_000;
4949

5050
export function createEventHandlers(context: EventHandlerContext) {
5151
const {
@@ -103,11 +103,11 @@ export function createEventHandlers(context: EventHandlerContext) {
103103
streamingWatchdogRunId = null;
104104
state.activeChatRunId = null;
105105
setActivityStatus("idle");
106-
chatLog.addSystem(
107-
`streaming watchdog: no stream updates for ${Math.round(
108-
streamingWatchdogMs / 1000,
109-
)}s; resetting status. The backend may have dropped this run silently — send a new message to resync.`,
110-
);
106+
/* Watchdog fires silently — the internal reset (clearing activeChatRunId,
107+
setting status idle) still happens, but the user-visible warning is
108+
suppressed to avoid false-positive noise during long-running agent
109+
turns (tool calls, sub-agent work, code generation). The user can
110+
always send a new message to resync if something is truly stuck. */
111111
tui.requestRender();
112112
}, streamingWatchdogMs);
113113
const maybeUnref = (streamingWatchdogTimer as { unref?: () => void }).unref;

0 commit comments

Comments
 (0)