From 213048a2dcf55080e070e6ae224a1050e9d4f089 Mon Sep 17 00:00:00 2001 From: ciregenz Date: Tue, 9 Jun 2026 18:13:13 -0700 Subject: [PATCH] [eric] frontend: trust local live status in the session-snapshot merge, a racing stale snapshot hid the just-sent user bubble until run end --- frontend/src/shared/state/agentsSlice.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/frontend/src/shared/state/agentsSlice.ts b/frontend/src/shared/state/agentsSlice.ts index 10771998..e7eb7f4a 100644 --- a/frontend/src/shared/state/agentsSlice.ts +++ b/frontend/src/shared/state/agentsSlice.ts @@ -1252,7 +1252,12 @@ const agentsSlice = createSlice({ // any local message the snapshot lacks; on a settled session the snapshot // is authoritative (so a server-side delete isn't resurrected). const incomingMsgs = session.messages ?? []; - const liveStatus = session.status === 'running' || session.status === 'waiting_approval'; + // Live by EITHER side's account: a send on a completed chat flips local + // status to running while the racing snapshot still says completed and + // lacks the new turn; trusting only the snapshot wiped the user bubble + // until the run finished. + const isLive = (s?: string) => s === 'running' || s === 'waiting_approval'; + const liveStatus = isLive(session.status) || isLive(existing?.status); const incomingClientIds = new Set( incomingMsgs.map((m) => m.client_message_id).filter(Boolean), );