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.
This commit is contained in:
2026-10-20 12:57:44 +01:00
parent 0d7e81362f
commit e6be00e1a1
2 changed files with 6 additions and 1 deletions
+3
View File
@@ -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()
}
+3 -1
View File
@@ -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);
}