From e6be00e1a131e549dd82201fde74ce3534289708 Mon Sep 17 00:00:00 2001 From: Alan Silva Date: Tue, 20 Oct 2026 12:57:44 +0100 Subject: [PATCH] web: fold background chat safely and harden notify mode Limit live chat paints and history syncs to the open conversation; initialize the per-run notify map lazily. --- internal/server/notify.go | 3 +++ web/src/views/chat.js | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/server/notify.go b/internal/server/notify.go index fab2c36e..9e7aef5f 100644 --- a/internal/server/notify.go +++ b/internal/server/notify.go @@ -189,6 +189,9 @@ func (r *runner) setNotifyMode(id int64, mode string) { mode = "auto" } r.notifyMu.Lock() + if r.notifyModes == nil { + r.notifyModes = map[int64]string{} + } r.notifyModes[id] = mode r.notifyMu.Unlock() } diff --git a/web/src/views/chat.js b/web/src/views/chat.js index c8bef517..f4a2c6d3 100644 --- a/web/src/views/chat.js +++ b/web/src/views/chat.js @@ -765,7 +765,9 @@ function onChatEvent(frame) { // missed) appears without a manual refresh. const knownTurn = messageId !== "" && (thread.messages ?? []).some((m) => m?.id === messageId); state.chatThreads.set(sessionId, applyChatEvent(thread, frame, Date.now())); - scheduleChatRender("transcript"); + if (state.view === "chat" && sessionId === state.chatActiveId) { + scheduleChatRender("transcript"); + } if (!knownTurn) scheduleHistorySync(sessionId, messageId); }