fix(resource-usage): skip kill-confirm dialog for orphan sessions

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 <help@stably.ai>
This commit is contained in:
Jinwoo-H
2026-05-05 14:31:36 -04:00
co-authored by Orca
parent 5aff4deff9
commit feaf424563
@@ -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) {