Repository navigation
VC-796: host-owned project.remove stops a project's live work before its delete - #920
Merged
hussainph merged 3 commits intoOct 19, 2026
Conversation
…its delete Removing a project deleted its row (and, by cascade, every Session and its event history) while the Sessions' structured bindings, background shells, terminals and Browser Tabs stayed live; the only teardown ran in the renderer, after the delete, and killed terminal PTYs alone. project.remove (a DESKTOP_ENTRIES key and a handler-map entry) now releases the project's Sessions' bindings, disposes their shells, kills their terminals, closes the project's tabs and cancels its MCP sign-ins; then deletes; then forgets the cascaded MCP servers' credentials, ends the board feed and publishes data-changed to every window. volli:project-remove is its projection, and the renderer only forgets its own views.
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…-a-project-cascades-deletes-its-sessions
…-a-project-cascades-deletes-its-sessions
This was referenced Oct 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Base update: #884 and #895, which this branch was stacked on, have both merged into
main, so the diff againstmainis now this one commit.Defect
volli:project-remove(apps/desktop/src/main/data-ipc.ts) randeleteProject(db, id), a bareDELETE FROM projects. With foreign keys on, that delete cascades:sessions.project_idandsession_events.session_idare bothON DELETE CASCADE, so it removed every Session of the project along with its event history. The work those Sessions held stayed live:The only teardown ran in the renderer after the delete (
stores/projects.ts), and it only killed PTYs. Nodata-changedwas published, so a second window kept showing the project.Fix
project.removeis a newDESKTOP_ENTRIESkey (host-command,workspaceplacement, matching the channel's VC-574 placement) with a handler-map entry. The handler runsremoveProject(packages/host-core/src/project-remove.ts) in this order:sessions.project_id):releaseAgentSessionsis a session-id sibling ofreleaseAgentSites, because ticket worktrees need not sit under the project folder;BackgroundShellHost.disposeSessionfor each Session;PtyManager.killSessions, whichever window owns the PTY;McpSettingsService.disconnectProject, which cancels in-flight MCP sign-ins and names the servers. Each Session's own MCP connections close when its binding is released.McpSettingsService.forgetRemovedServers: callsMcpCredentialStore.deletefor every cascaded server, but only once its row is gone.data-changedto every window. It goes throughfeed.untappedso the disposed feed is not re-stamped. The renderer's untargeted refresh re-reads the project list, so a second window drops the project.hostProjectLiveWorkbuilds those ports from a host's services. Desktop main wires it increateHostHandlers;onProjectRemovedis gone.volli:project-removenow just invokeshandlers["project.remove"]under the desktop window's policy.Renderer:
stores/projects.tsno longer kills PTYs. It callsforgetProjectSessions, which only disposes terminal engines and drops records.remove-project-busy.ts).How the regression tests prove it
apps/desktop/src/main/data-ipc.test.ts › project removaldata-changedreached the windows.{ ok: false }.main: I checked by revertingdata-ipc.tsandstores/projects.tson this branch. Nothing is stopped and nodata-changedis sent.packages/host-core/src/project-remove.test.ts(enrolled at 100% coverage):hostProjectLiveWork, a turn open in a ticket worktree outside the project folder is released by Session id.mcp/settings.test.ts: credential rows are gone only after the delete, and another project's are kept.pty/manager.stream.test.ts:killSessionskills exactly the named PTYs across windows.stores/projects.test.ts: removal no longer callsterminal.kill.session-lifecycle.test.ts:forgetProjectSessionsdisposes and forgets but kills nothing.Decisions
{ kind: "user" }: removing the project was the person's act. No newSessionOriginreason was added.data-changedis untargeted. A targeted change for a project a window holds only re-reads that project's roster, which would not drop it.volli:project-removestays a channel that projects the handler, as the ticket proposed. It is not moved onto the RPC client.Not in this PR
next_ticket_numberafter a re-add (VC-822's list).Checks run locally
vp check: pass.@volli/shared,@volli/host-core,@volli/session-rpc,@volli/desktop,@volli/hostd, plus the roottsc -p tsconfig.json: pass.pnpm check:protocol-schema --base origin/main: additive check passed; the schema was regenerated with the generator.desktop-entries,handler-keys;desktop-router,desktop-ipc,handler-projection,protocol-schema,session-handlers.test-support;project-remove,host-handlers,mcp/settings,pty/manager.stream,worktree/agent-sites;data-ipc,session-lifecycle,stores/projects,remove-project-busy,ipc/placement.project-remove.ts,host-handlers.ts,session-lifecycle.tsanddesktop-router.ts, each checked alone.CI history
7d115ac6e): Check + Build failed on main's own lint breakage, areact(purity)error inupdates-pane.tsx, later fixed by VC-294: compute the Updates status clock outside render (unbreaks main: react/purity) #923. Everything else passed.mainat6fd35e29b: Check + Build failed on main's TS2353WorktreePorts.giterrors, fixed by VC-786: drop the removed git port from tests merged beside #908 (unbreaks main typecheck) #925.worktree/watch.test.ts.session-runtime/crash-recovery.integration.test.tsfailed once instead.mainatf794e5b3c(head7b90883c9): every check passed on the first attempt, including CI gate, with no retry.