diff --git a/ui/src/ui/app-chat.ts b/ui/src/ui/app-chat.ts index b46a69c0d8a7..b539fdc2995d 100644 --- a/ui/src/ui/app-chat.ts +++ b/ui/src/ui/app-chat.ts @@ -269,13 +269,13 @@ function chatRunWatchdogResultIsTerminal( if (status !== "timeout" && status !== "timed_out") { return true; } - return Boolean( + return ( result?.endedAt != null || - result?.error != null || - result?.stopReason != null || - result?.livenessState != null || - result?.yielded === true || - result?.pendingError === true, + result?.error != null || + result?.stopReason != null || + result?.livenessState != null || + result?.yielded === true || + result?.pendingError === true ); } diff --git a/ui/src/ui/app-lifecycle.node.test.ts b/ui/src/ui/app-lifecycle.node.test.ts index e0e8dc5e48b3..b622e0a65b2a 100644 --- a/ui/src/ui/app-lifecycle.node.test.ts +++ b/ui/src/ui/app-lifecycle.node.test.ts @@ -26,7 +26,7 @@ function createHost() { chatMessages: [], chatToolMessages: [], chatStream: null, - chatRunId: null, + chatRunId: null as string | null, chatRunLastActivityAt: null as number | null, chatRunWatchdogTimer: null as ReturnType | number | null, chatRunWatchdogProbeInFlight: false, diff --git a/ui/src/ui/controllers/chat.test.ts b/ui/src/ui/controllers/chat.test.ts index 470fa30ed982..d8c1bae28d58 100644 --- a/ui/src/ui/controllers/chat.test.ts +++ b/ui/src/ui/controllers/chat.test.ts @@ -2164,6 +2164,7 @@ describe("chat run watchdog", () => { toolStreamOrder: [], chatToolMessages: [], chatStreamSegments: [], + updateComplete: Promise.resolve(), basePath: "", settings: { gatewayUrl: "ws://gateway.test/control", @@ -2212,7 +2213,7 @@ describe("chat run watchdog", () => { }); expect(request).toHaveBeenCalledWith( "chat.history", - expect.objectContaining({ sessionKey: "main", limit: 200 }), + expect.objectContaining({ sessionKey: "main", limit: 100 }), ); expect(request).toHaveBeenCalledWith( "chat.send",