[eric] agents: rehydrate browser-agent children the trimmed session-list poll leaves message-less (feed no longer blanks)

This commit is contained in:
ciregenz
2026-07-15 12:58:44 -07:00
parent a7a095a379
commit e52f4a1b8a
2 changed files with 11 additions and 3 deletions
@@ -197,14 +197,18 @@ const BrowserAgentInlineFeed: React.FC<Props> = ({ 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) => {
+5 -1
View File
@@ -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;
}
}
})