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; } } })