From 89ac24da5b31756111adc2010826cbe6bd3ca248 Mon Sep 17 00:00:00 2001 From: ciregenz Date: Tue, 9 Jun 2026 17:20:10 -0700 Subject: [PATCH] [eric] frontend: scope the session-list strip to the fetched dashboard, hopping dashboards ate finished chats --- frontend/src/shared/state/agentsSlice.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frontend/src/shared/state/agentsSlice.ts b/frontend/src/shared/state/agentsSlice.ts index 41ae56b1..10771998 100644 --- a/frontend/src/shared/state/agentsSlice.ts +++ b/frontend/src/shared/state/agentsSlice.ts @@ -1017,9 +1017,13 @@ const agentsSlice = createSlice({ const fetchedIds = new Set(action.payload.map((s) => s.id)); const activeStatuses = new Set(['running', 'waiting_approval']); - // Strip stale fetched sessions; keep other dashboards, drafts, tracked, and active sessions. + // Strip sessions the server no longer has, but a dashboard's list is only + // authoritative for ITS OWN sessions: hopping dashboards must not eat the + // finished chat you were just reading (it looked like wiped history). + const fetchedDashboardId = action.meta.arg?.dashboardId; for (const [id, existing] of Object.entries(state.sessions)) { if (fetchedIds.has(id)) continue; + if (fetchedDashboardId && existing.dashboard_id !== fetchedDashboardId) continue; if (existing.status === 'draft') continue; if (state.trackedNotificationIds.includes(id)) continue; if (activeStatuses.has(existing.status)) continue;