fix(webui): start a fresh event stream at recent activity, not the whole events table
deploy / plan (push) Successful in 25s
deploy / archied-image (push) Canceled after 0s
deploy / agent-image (push) Canceled after 0s
deploy / dist-zip (push) Canceled after 0s
deploy / gate (push) Canceled after 2m38s

This commit is contained in:
sam committed 2026-11-08 23:29:40 +11:00
1 parent 67fa57008e
commit 43ba64684e
1 file changed
+6 -1
+6 -1
View File
@@ -16,6 +16,9 @@ import (
// sseBacklogPageSize bounds one EventsSince fetch during catch-up.
const sseBacklogPageSize = 200
// sseFreshWindow is how far back a connection without a cursor starts.
const sseFreshWindow = 5 * time.Minute
// sseNoiseKinds are event kinds not sent to the dashboard stream.
var sseNoiseKinds = map[string]bool{
events.KindTurnCompleted: true,
@@ -128,7 +131,9 @@ func sseCursors(r *http.Request) streamCursors {
cursors.Tasks = value // legacy task cursor
}
if _, _, ok := storecontract.ParseEventCursor(cursors.Tasks); !ok {
cursors.Tasks = ""
// A new viewer needs recent activity, not the whole events table:
// replaying every event ever recorded froze the dashboard.
cursors.Tasks = storecontract.EventCursor(time.Now().Add(-sseFreshWindow), 0)
}
if cursors.Logs < 0 {
cursors.Logs = 0