From e52f4a1b8a6d3a3e0d661c2246eb6a6fac66ab3d Mon Sep 17 00:00:00 2001 From: ciregenz Date: Wed, 15 Jul 2026 12:58:44 -0700 Subject: [PATCH] [eric] agents: rehydrate browser-agent children the trimmed session-list poll leaves message-less (feed no longer blanks) --- .../app/pages/AgentChat/shell/BrowserAgentInlineFeed.tsx | 8 ++++++-- frontend/src/shared/state/agentsSlice.ts | 6 +++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/frontend/src/app/pages/AgentChat/shell/BrowserAgentInlineFeed.tsx b/frontend/src/app/pages/AgentChat/shell/BrowserAgentInlineFeed.tsx index 65aa7383..b636a9a4 100644 --- a/frontend/src/app/pages/AgentChat/shell/BrowserAgentInlineFeed.tsx +++ b/frontend/src/app/pages/AgentChat/shell/BrowserAgentInlineFeed.tsx @@ -197,14 +197,18 @@ const BrowserAgentInlineFeed: React.FC = ({ parentSessionId, browserId }) shallowEqual, ); + // A child that arrived only through the trimmed session-list poll carries its message_count but no messages; fetch the full children so its history renders instead of showing a blank feed. + const needsChildFetch = + browserSessions.length === 0 || + browserSessions.some((s) => (s.message_count ?? 0) > 0 && s.messages.length === 0); useEffect(() => { - if (browserSessions.length === 0 && fetchedForSession.current !== parentSessionId) { + if (needsChildFetch && fetchedForSession.current !== parentSessionId) { fetchedForSession.current = parentSessionId; dispatch(fetchBrowserAgentChildren(parentSessionId)) .unwrap() .catch(() => { fetchedForSession.current = null; }); } - }, [browserSessions.length, parentSessionId, dispatch]); + }, [needsChildFetch, parentSessionId, dispatch]); const sessionsWithHistoricalEntries = useMemo(() => { return browserSessions.map((session) => { diff --git a/frontend/src/shared/state/agentsSlice.ts b/frontend/src/shared/state/agentsSlice.ts index 11db25a8..504f8acd 100644 --- a/frontend/src/shared/state/agentsSlice.ts +++ b/frontend/src/shared/state/agentsSlice.ts @@ -1416,13 +1416,17 @@ const agentsSlice = createSlice({ }) .addCase(fetchBrowserAgentChildren.fulfilled, (state, action) => { for (const session of action.payload) { - if (!state.sessions[session.id]) { + const existing = state.sessions[session.id]; + if (!existing) { state.sessions[session.id] = { ...session, name: normalizeSessionName(session.name), tool_group_meta: session.tool_group_meta ?? {}, pending_approvals: session.pending_approvals ?? [], }; + } else if (existing.messages.length === 0 && session.messages.length > 0) { + // Hydrate a child the trimmed session-list poll left message-less; don't touch one mid-stream (already has messages). + existing.messages = session.messages; } } })