SIGN IN SIGN UP

Fix deleting forked session showing wrong confirmation dialog (#313205)

When clicking X on a sub-session tab, deleteChat checks chatIds.length
before finding the specific chat by URI. If the grouping cache doesn't
include the forked chat (e.g. due to stale sessionParentId metadata),
_getChatIdsInGroup returns only the main chat. The chatIds.length <= 1
check then falls through to deleteSession, which shows 'delete this
session?' and deletes the entire session including the worktree.

Fix: find the specific chat by URI first. Only fall through to
deleteSession if the chat IS found in the group AND it's the last one.

Fixes #313148

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
S
Sandeep Somavarapu committed
a654c5067a03a7adb51ce73dbcfed457467d07ad
Parent: c76e907
Committed by GitHub <noreply@github.com> on 4/29/2026, 12:53:38 PM