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 <cursoragent@cursor.com>
This commit is contained in:
kumarabhirup 2026-02-22 01:03:22 -08:00
parent 36553cf0c0
commit 20ace16d4c
No known key found for this signature in database
GPG Key ID: DB7CA2289CAB0167
2 changed files with 14 additions and 4 deletions

View File

@ -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

View File

@ -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) {