From ca28d082694aa4082ddf9869d972c8932056de55 Mon Sep 17 00:00:00 2001 From: Alan Silva Date: Tue, 20 Oct 2026 00:24:05 +0100 Subject: [PATCH] web: keep one chat clock across streaming re-renders MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Every streamed delta re-rendered the conversation and restarted the indicator's one-second ticker, so a busy turn cleared the timer before it fired and the chat sat at "Thinking… · 0s" for the whole turn. The ticker is now kept while a turn is in flight; a simulated silent turn ticks 0s→4s and clears on step end. --- web/src/views/chat.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/web/src/views/chat.js b/web/src/views/chat.js index 4a1d3248..46090396 100644 --- a/web/src/views/chat.js +++ b/web/src/views/chat.js @@ -3210,16 +3210,21 @@ function updateChatJump(el) { * per-tool `· long` marks in place (never a full re-render). */ function refreshChatClock() { - stopChatClock(); chatNow = Date.now(); const thread = state.chatActiveId ? state.chatThreads.get(state.chatActiveId) : null; const awaiting = approvalCard(thread?.permission, thread?.permissionAnswer)?.actionable === true; - if (state.view === "chat" && thread?.running && !awaiting) { - chatClock = setInterval(() => { - chatNow = Date.now(); - updateChatIndicator(chatNow); - }, 1000); + if (state.view !== "chat" || !thread?.running || awaiting) { + stopChatClock(); + return; } + // Keep the one ticker. A streaming turn re-renders on every delta, and a clock + // restarted on each render would be cleared before its first second elapsed, so + // the indicator's elapsed time sat at 0s for the whole turn. + if (chatClock) return; + chatClock = setInterval(() => { + chatNow = Date.now(); + updateChatIndicator(chatNow); + }, 1000); } function stopChatClock() {