From 8159d79c4aeadefaf0695dcae713f8ce5fb84962 Mon Sep 17 00:00:00 2001 From: ciregenz Date: Tue, 9 Jun 2026 02:51:40 -0700 Subject: [PATCH] [eric] frontend: stop the session-list poll from clobbering live chat messages, fixes the user bubble vanishing on click-out/in --- frontend/src/shared/state/agentsSlice.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/frontend/src/shared/state/agentsSlice.ts b/frontend/src/shared/state/agentsSlice.ts index 5c265acc..41ae56b1 100644 --- a/frontend/src/shared/state/agentsSlice.ts +++ b/frontend/src/shared/state/agentsSlice.ts @@ -1031,6 +1031,13 @@ const agentsSlice = createSlice({ const existing = state.sessions[s.id]; state.sessions[s.id] = { ...s, + // This is a METADATA poll (status/name); the chat owns its messages + // via fetchSession + the WS stream. A poll response computed before a + // just-sent user turn must NOT clobber the live array, that intermittently + // wiped the user's own bubble (while the assistant stream, a separate + // slice, kept rendering). Keep the hydrated messages; only adopt the + // poll's copy for a session we haven't loaded into the chat yet. + messages: existing?.messages?.length ? existing.messages : s.messages ?? [], pending_approvals: existing?.pending_approvals?.length ? existing.pending_approvals : s.pending_approvals ?? [],