From 20ace16d4c865fe0711b31b2cbdc532bd38a74b7 Mon Sep 17 00:00:00 2001 From: kumarabhirup Date: Sun, 22 Feb 2026 01:03:22 -0800 Subject: [PATCH] fix(web): prevent subagent sessions from leaking into chat sidebar - Skip updateIndex for session IDs containing :subagent: so they don't appear as top-level "New Chat" entries in the sidebar - Filter subagent IDs in the sidebar component as a safety net - Clean up existing leaked entries from index.json Co-authored-by: Cursor --- .../components/workspace/chat-sessions-sidebar.tsx | 7 ++++++- apps/web/lib/active-runs.ts | 11 ++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/apps/web/app/components/workspace/chat-sessions-sidebar.tsx b/apps/web/app/components/workspace/chat-sessions-sidebar.tsx index 24d16a5dba0..b3e9e5b7bf4 100644 --- a/apps/web/app/components/workspace/chat-sessions-sidebar.tsx +++ b/apps/web/app/components/workspace/chat-sessions-sidebar.tsx @@ -220,8 +220,13 @@ export function ChatSessionsSidebar({ return map; }, [subagents]); + const filteredSessions = useMemo( + () => sessions.filter((s) => !s.id.includes(":subagent:")), + [sessions], + ); + // Group sessions: today, yesterday, this week, this month, older - const grouped = groupSessions(sessions); + const grouped = groupSessions(filteredSessions); const width = mobile ? "280px" : (widthProp ?? 260); const headerHeight = 40; // px — match padding so list content clears the overlay diff --git a/apps/web/lib/active-runs.ts b/apps/web/lib/active-runs.ts index 86077afa451..0bc2282b437 100644 --- a/apps/web/lib/active-runs.ts +++ b/apps/web/lib/active-runs.ts @@ -1557,12 +1557,17 @@ function upsertMessage( if (!found) { updated.push(JSON.stringify(message)); - updateIndex(sessionId, { incrementCount: 1 }); - } else { - updateIndex(sessionId, {}); } writeFileSync(fp, updated.join("\n") + "\n"); + + if (!sessionId.includes(":subagent:")) { + if (!found) { + updateIndex(sessionId, { incrementCount: 1 }); + } else { + updateIndex(sessionId, {}); + } + } } function cleanupRun(sessionId: string) {