fix: forward workspace root approval to worker on Add Project#173
Merged
DeadWaveWave merged 1 commit intoDeadWaveWave:mainfrom Apr 15, 2026
Merged
Conversation
In packaged builds the desktop runs agents through a worker process that owns its own ApprovedWorkspaceStore. When the user adds a new project via the native directory picker, the root was only registered in the desktop's local store — the worker never learned about it, so the subsequent agent launch was rejected with "The selected path is outside approved workspaces." Wrap the ApprovedWorkspaceStore passed to registerWorkspaceIpcHandlers so that registerRoot also calls workspace.approveRoot on the worker control surface, keeping both stores in sync at runtime. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
💡 Change Scope
📝 What Does This PR Do?
Fixes a bug where adding a new project in the packaged (release) build and then running an agent fails with:
The same flow works fine in
pnpm devbecause dev mode runs instandalonemode (no worker process).Root Cause
In packaged builds, the desktop spawns a local worker process (
effectiveMode: 'local'). The desktop and the worker each own a separateApprovedWorkspaceStoreinstance. When the user adds a project via the native directory picker,workspaceSelectDirectoryonly callsregisterRooton the desktop's local store. Agent launches are forwarded to the worker viaregisterRemoteAgentIpcHandlers→session.launchAgent, where the worker checks its own store — which doesn't know about the newly added root.Compare with the web canvas
AddProjectDialog, which correctly callsworkspace.approveRooton the worker control surface.Fix
Wrap the
ApprovedWorkspaceStorepassed toregisterWorkspaceIpcHandlersso thatregisterRootalso forwards the call to the worker'sworkspace.approveRootcontrol surface endpoint when aworkerEndpointResolveris present. Gracefully degrades if the worker isn't ready — the shared JSON file ensures the worker picks up the root on its next cold load.Key changes
src/app/main/ipc/registerIpcHandlers.ts: Create a forwarding wrapper aroundapprovedWorkspacesthat calls both the local store and the worker control surface onregisterRoot.✅ Delivery & Compliance Checklist
🤖 Generated with Claude Code