Repository navigation
fix(projects): removing a project on this computer stops its chats, pages and every terminal on the host - #30728
Conversation
… on the host, like repo.rm
…l to stop; paired residue rows are no twins
|
Important Review skippedReview was skipped as selected files did not have any reviewable changes. ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 Walkthrough
Priority: ➖ Normal Merge Risk: 🟡 Moderate · up to
|
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
1b02f2b3-ea21-441e-861c-f2f8f3c35c41
📒 Files selected for processing: 11
src/main/ipc/repos.tssrc/main/ipc/repos/project-host-setup-wsl-move-fence.test.tssrc/main/ipc/repos/repo-catalog-handlers.tssrc/main/ipc/repos/repo-ipc-wsl-move-fence.test.tssrc/main/ipc/repos/repo-remove-for-host-teardown.test.tssrc/main/runtime/project-removal-structured-sessions.test.tssrc/main/runtime/runtime-repository-settings-controller.tssrc/main/runtime/terminal/stop/project-terminal-stop.tssrc/main/runtime/terminal/stop/worktree-terminal-stop-options.tssrc/main/runtime/terminal/stop/worktree-terminal-stop.tssrc/renderer/src/store/repos/repo-removal.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.
| /** A paired server's row is residue here: its sessions run on that server, never in this process. */ | ||
| private rowsRunHere(): Repo[] { | ||
| return (this.store?.getRepos?.() ?? []).filter( | ||
| (row) => parseExecutionHostId(getRepoExecutionHostId(row))?.kind !== 'runtime' |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Exclude residue rows from post-removal spawn admission.
If a local row and a runtime: residue row share an ID, removal records the local null connection fence but leaves the residue row. removedProjectAdmitsSpawn at Lines 237–241 still treats that residue as a surviving local owner. A local spawn waiting behind the removal can then pass acquireWorktreeTerminalSpawn and create a PTY after the project is removed. Apply the rowsRunHere() filter to spawn admission as well.
ELI5
When you removed a project from this computer (a local folder, or an SSH project the desktop connects to itself), Orca only closed the terminals this window happened to know about. AI chats, browser pages opened by agents, and terminals from another window or a restart kept running with no project left to show them. Now the removal asks the part of Orca that actually runs those sessions to stop all of them, the same way removing a project from a paired server already did.
What Changed
Before. The desktop's
repos:removeForHostonly dropped the store row. The renderer'sremoveProjectthen sentpty.killfor the PTYs in its own tab list. Native chats, host browser pages and failed-launch records were never released. PTYs the window didn't list kept running.After.
(repoId, hostId)row and the host is not a pairedruntime:server,repos:removeForHostcallsruntime.removeProject(row). This is the sameRuntimeRepositorySettingsController.removethatrepo.rmuses.removenow takes a selector or the exact row, so twins never becomeselector_ambiguous.requestStopsPastDeadline, so each remaining PTY still gets a non-waiting stop. It is never counted as stopped. This also fixesrepo.rmon headless servers. Worktree removal keeps its old behaviour.runtime:stamps) no longer count as same-fence twins. A local project whose id matches a residue row used to have its whole host-side sweep skipped.Why
The host owns execution (AGENTS.md), so the sweep belongs where the session tables are, not in a window's partial view. Reusing the
repo.rmcontroller keeps one removal path for local and paired clients.Alternatives considered:
ref-oss check: not needed (2 review rounds).
Linked Issue
Round 4 hardening R4-5, the renderer/desktop half (internal tracker); no GitHub issue.
Visual Proof
N/A: no UI change. Removing a project now takes as long as
repo.rmalready did on a paired server: up to the 10 s terminal budget plus the chat close.Testing
All of these fail before the fix:
src/main/ipc/repos/repo-remove-for-host-teardown.test.ts:runtime.removeProject(row);runtime:residue row is only dropped.src/main/runtime/project-removal-structured-sessions.test.ts:runtime:residue row shares its id;kill.Local runs:
Not verified live; the Docker lane is advisory.
Review
repo.rmalready does;repo.rmdoes.Agent skill upstream boundary
Notes
repo.rmparams are unchanged, and older clients get the past-deadline stops for free.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)