Repository navigation
fix(runtime): one teardown policy per kind; removal closes host browser pages everywhere, headless sleep stops terminals - #30715
Conversation
…browser pages everywhere, headless sleep stops terminals A declared table says what each entry point (worktree, folder and project removal, sleep, disconnect) does to each owned kind (PTY, native chat, host browser page, launch record), so a new kind is a compile error until decided. Removal over desktop IPC and repo.rm now close the host's browser pages and launch records like the runtime removal; worktree.sleep with no renderer sleeps the host's terminals instead of doing nothing. Sleep->chat is declared pending #28445; disconnect stops nothing.
…s without a client page; stub the new runtime method
…page owners through the bridge, not Electron
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to
|
ELI5
When you remove or sleep a workspace, Orca must stop whatever that workspace runs on its machine: terminals, native agent chats, browser pages, and leftover launch records. Different removal paths had each grown their own list, and some forgot items. Now one table says, for each action and each kind of item, whether it is stopped or kept. Every path reads that table.
What Changed
User-visible fixes:
repo.rm, the CLI, or a paired client) now closes that project's browser pages hosted on the machine and forgets its failed agent launches. Before, they stayed open or recorded for the life of the server.serve, or a desktop whose window has closed) now sleeps that workspace's terminals. Before, it only told a window that wasn't there and returned success. A stop that can't be proven is now reported as an error, never as "asleep".Mechanism:
src/main/runtime/owned-session-teardown-policy.tsdeclares the kinds (pty,structured-chat,host-browser,launch) and the entry points (worktree, folder and project removal, sleep, disconnect). Asatisfies Record<…, Record<…>>table makes a new kind or entry point a compile error until someone decides it. The decided policy:stop-pending-28445; that stop itself is Sleep stops a workspace's native chat agents #28445's.closeStructuredSessionsflags now read from the table.releaseRemovedWorktreeHostSessions, closes headless pages and client-hosted page records and forgets failed launches.sleepManagedWorktreeruns the host's ownsleepTerminalsForWorktreewhen no window is attached. A window keeps its existing renderer-ordered flow.Why
Linked Issue
Round 4 SSH hardening, R4-5 (owned-session teardown registry). No issue filed.
Visual Proof
N/A: host-side process and page cleanup; nothing on screen changes.
Testing
owned-session-teardown-policy.test.ts:pnpm tcpassed;src/main/ipc/worktrees,src/main/runtime,src/main/browser,src/main/agent-launch. Some files fail locally the same way without this change: twoorca-runtime.test.tscases (macOS/private/vartmpdir realpaths) and thebrowser-manager-tab-identityand-viewport-ownershipsuites.Review
Agent skill upstream boundary
Notes
Checklist