From feaf424563c1dfbd9a07ec0bfe6dad12ffbaaff2 Mon Sep 17 00:00:00 2001 From: Jinwoo-H Date: Tue, 5 May 2026 00:10:11 -0400 Subject: [PATCH] fix(resource-usage): skip kill-confirm dialog for orphan sessions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Orphan sessions have no tab in this Orca instance, so there's no "unsaved work in that pane" risk that justifies the confirm step. Clicking the X on an orphan now optimistically removes the row and fires pty.kill straight away — same UX as the bulk Kill orphan terminals button. Bound sessions still confirm because killing them takes a tab the user is actively working in. Co-authored-by: Orca --- .../status-bar/ResourceUsageStatusSegment.tsx | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/renderer/src/components/status-bar/ResourceUsageStatusSegment.tsx b/src/renderer/src/components/status-bar/ResourceUsageStatusSegment.tsx index 9c4098b7979..5158f65b2fc 100644 --- a/src/renderer/src/components/status-bar/ResourceUsageStatusSegment.tsx +++ b/src/renderer/src/components/status-bar/ResourceUsageStatusSegment.tsx @@ -861,9 +861,25 @@ export function ResourceUsageStatusSegment({ void runSleepWorktree(id) }, []) - const handleKillSession = useCallback((session: UnifiedSessionRow): void => { - setKillConfirm(session) - }, []) + const handleKillSession = useCallback( + (session: UnifiedSessionRow): void => { + // Why: orphan sessions have no tab in this Orca instance, so there's + // no "unsaved work in that pane" the user could lose by killing them. + // Skip the confirm dialog for orphans and fire the kill straight away + // (with optimistic removal) — same UX as a one-off kill from the + // bulk "Kill orphan terminals" button. Bound sessions still confirm. + if (!session.bound) { + setSessions((prev) => prev.filter((s) => s.id !== session.sessionId)) + void window.api.pty.kill(session.sessionId).catch(() => { + /* already dead */ + }) + void refreshSessions() + return + } + setKillConfirm(session) + }, + [refreshSessions] + ) const handleKillOrphans = useCallback(async () => { if (!workspaceSessionReady) {