From 08355c09a685fd519dd531ee9a04a50b8338bdf0 Mon Sep 17 00:00:00 2001 From: ciregenz Date: Tue, 23 Jun 2026 19:22:41 -0700 Subject: [PATCH] [eric] frontend: resume button persists across reload (derive from persisted stopped status) --- frontend/src/app/pages/AgentChat/AgentChat.tsx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/frontend/src/app/pages/AgentChat/AgentChat.tsx b/frontend/src/app/pages/AgentChat/AgentChat.tsx index c8237d3b..035a85a2 100644 --- a/frontend/src/app/pages/AgentChat/AgentChat.tsx +++ b/frontend/src/app/pages/AgentChat/AgentChat.tsx @@ -481,6 +481,18 @@ const AgentChat: React.FC = ({ sessionId: sessionIdProp, onClose } }, [session?.status, mode, modesMap, id, isDraft, dispatch, dispatchMessage]); + // A reload remounts past the live running->stopped transition that first shows + // the resume button, so re-derive it once from the persisted 'stopped' status + // (transcript-gated so a cleared chat can't resurrect it). + const resumeHydratedRef = useRef(false); + useEffect(() => { + if (resumeHydratedRef.current) return; + if (session?.status === 'stopped' && (session?.messages?.length ?? 0) > 0) { + resumeHydratedRef.current = true; + setShowResumeBubble(true); + } + }, [session?.status, session?.messages?.length]); + // Idle reconcile: if the session has been 'running' for 5s with no // WebSocket activity (no new messages, no streaming updates), do a // single GET to fetch the real status from the backend. Catches the