Repository navigation
fix(runtime): tell open windows when the CLI changes a project setup - #26564
sotashimozono wants to merge 1 commit into
Conversation
`orca project setup-create`, `setup-update` and `setup-delete` change the store through the runtime RPC, but an open window and paired clients were never told, so a removed project stayed in the sidebar until restart. The desktop IPC handlers for the same operations already send that notice. The three RPC paths now send it too. Removing a setup that has a repo also drops the caches `repo.rm` drops for the same row: resolved worktrees, the worktree scan and authorized roots. Fixes stablyai#26562
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (3)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe runtime controller now notifies repo listeners after successful setup creation and update. When setup deletion removes a repo, the controller invalidates related caches and notifies listeners. Failed folder linking uses the same cleanup helper. Unit tests and an end-to-end test cover notifications, cleanup, and project-header removal from the open window. Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to The change is ready for normal merge checks; no actionable issue was identified. 🚥 Pre-merge checks | ✅ 6 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (6 passed)
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 |
|
Thanks for tracking this down, @sotashimozono! This is already fixed on main by #26941 (d56c0fb), which also closed #26562. |
|
thank you for your response. |
ELI5
orca project setup-deleteremoves a project from Orca. The removal worked, but the Orca window that was open at the time was never told, so its sidebar kept showing a project that was already gone. This PR makes the CLI path send the same "the project list changed" notice that the window's own buttons already send.What Changed
Before: after
orca project setup-delete --setup <id>,orca project setupsno longer lists the entry, but an open window keeps the project in the sidebar until it is restarted.setup-createandsetup-updatehave the same gap, and paired clients are not told either.After: the open window and paired clients refresh their project list as soon as the command returns. For a removal, the project header disappears.
Mechanism: these commands call the runtime RPC methods
projectHostSetup.create,.updateand.delete, whichRuntimeProjectHostSetupControllerhandles. The controller wrote to the store and returned. It now callsnotifyReposChangedafter each successful write, which is what the desktop handlers for the same three operations (projectHostSetups:*inproject-host-setup-handlers.ts) already do.Removing a setup that has a repo behind it now also drops three caches, the ones the
repo.rmRPC drops after removing the same row: resolved worktrees, the worktree scan for that repo, and authorized roots. The controller's rollback path already ran exactly this sequence, so both now share one private method.The production change is about 20 lines in one file. No RPC method, parameter or event is added.
Why
I found this while removing 48 projects of one host with a script. The CLI is the only scripted way to remove many projects today (#24542), and it is the one path that leaves an open window out of date.
Alternatives I considered:
repo.rm, project groups) notify inside the controller, and this controller's rollback path already did, so that is where it belongs.repo.rm's cleanup, including its terminal-topology reset. Left out on purpose. That counter is keyed by repo id, which two hosts can share, whiledeleteSetupremoves one host's row. A leftover counter entry is a small leak, not a visible bug, so this change stops at what the existing rollback path does.repo.rmas well.Known leftover, not changed here: once the window is told, it removes the project header but keeps that project's workspaces under an "Unknown" heading until restart. The same happens on
mainafterrepo.rm; I checked by swapping the call in the e2e test. The window does not drop the workspaces of a project that was removed outside it. The second screenshot shows this state.Linked Issue
Fixes #26562
Visual Proof
From the new e2e test (
tests/e2e/cli-project-setup-delete-sidebar.spec.ts). The app has one project, and the test removes its setup over the local runtime socket, the transport the CLI uses.main): 15 seconds after the removal, the sidebar still lists the projectIn the second screenshot the removed project's two workspaces remain under "Unknown". That is the leftover described under Why. The UI language in the screenshots is Japanese (my OS locale).
Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
runtime-project-host-setup-controller.test.ts, 6 new cases:main.tests/e2e/cli-project-setup-delete-sidebar.spec.ts(Playwright,ORCA_BACKGROUND_LAUNCH=1): opens the app with one project, callsprojectHostSetup.deleteover the local runtime socket, and expects the project header to leave the sidebar within 15 seconds. It fails onmainwith "the window still lists the removed project" and passes with this change.Ran the
src/main/runtimevitest folder under Node, because the pinned Bun is not installed on my machine: 1088 files pass. Six files (16 tests, allagent-session-*andagent-launch-*) fail, and they fail identically with this change stashed.pnpm tc:node,pnpm run check:code-quality:changedandpnpm run check:max-lines-ratchetpass.Not run locally: full
pnpm lint/pnpm test/pnpm build; relying on CI.Platforms: macOS only. Not tried with a paired client or with a setup on an SSH host.
AI Disclosure
Built with Claude Code (Claude Opus 5.5). It noticed the gap while scripting a project cleanup I had asked for, wrote the tests first and confirmed they fail without the change, wrote the fix, and ran a separate review pass that led to the rollback test.
Review
Agent skill upstream boundary
Notes
repo.rmalready does, so the removed folder stops counting as a registered root without waiting for another invalidation.deleteSetupalready removes only the row of the setup's own host. The notice and the cache invalidation are not host-specific. Not exercised against a real SSH host.reposChangedevent. Nothing new to decode.repo.rm.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)