Repository navigation
feat(workspace): set project location from the create-worktree host picker - #14868
Conversation
…icker Hosts that still say "Project location not set" now get an inline Set location action. It opens a nested dialog over Create worktree so the in-progress form stays put.
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan includes up to 10 reviews per rolling hour; 5 remain after this review. 📝 WalkthroughWalkthroughAdds project-location setup for eligible needs-setup hosts. The run-target picker exposes a Set project location action. The new dialog supports existing folders, Git URL cloning, local folder selection, and remote browsing. The composer manages nested dialog state and applies completed setup selections. Tests cover host eligibility, picker interactions, dialog workflows, compatibility merging, and composer integration. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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 |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: effe33cd-d477-4e0e-b9bb-03390e74f431
📒 Files selected for processing (15)
src/renderer/src/components/NewWorkspaceComposerCard.set-location.test.tsxsrc/renderer/src/components/NewWorkspaceComposerCard.test.tsxsrc/renderer/src/components/NewWorkspaceComposerCard.tsxsrc/renderer/src/components/NewWorkspaceComposerModal.tsxsrc/renderer/src/components/new-workspace/RunTargetCombobox.tsxsrc/renderer/src/components/new-workspace/RunTargetComboboxRow.tsxsrc/renderer/src/components/new-workspace/SetProjectLocationDialog.test.tsxsrc/renderer/src/components/new-workspace/SetProjectLocationDialog.tsxsrc/renderer/src/components/new-workspace/SetProjectLocationForms.tsxsrc/renderer/src/components/new-workspace/set-project-location-browse.test.tssrc/renderer/src/components/new-workspace/set-project-location-browse.tssrc/renderer/src/hooks/useComposerState.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/lib/project-host-setup-options.test.tssrc/renderer/src/lib/project-host-setup-options.ts
Included review availability: Your plan includes up to 10 reviews per rolling hour; 7 remain after this review.
Drop the redundant "Project location not set" caption and show a Set project location action with a hover tooltip instead.
- reuse CreateProjectParentBrowser instead of a second host-filesystem browse view - drop ProjectLocationBrowseTarget; parseExecutionHostId already models it - single setLocation path in RunTargetCombobox (row, button, Enter) - memoize the default clone URL instead of scanning on every store update - fix missing required props in the new composer-card test
- Escape in the host browser now backs out to the form instead of dismissing the dialog and discarding the half-filled path/clone URL. Radix dismisses from a document-capture listener, so only preventDefault can stop it. - Drop the stopPropagation guards: window-capture (the composer's Escape handler) already ran by then, so they never protected it — the nestedDialogOpen gate does. They did silently kill RemoteFileBrowser's own key handling. - Hide Set project location for host-local repo:<id> projects (folder projects, git repos with no remote). Linking on another host matches by project identity, which those have none of, so the call could only ever toast an error. - Drop a standalone placeholder setup once a repo projection covers the same project+host, restoring the (projectId, hostId) uniqueness invariant. Setting a location on a host with a pending setup was leaving a ghost that sorts first and reads back as 'not set up'. - Existing-folder submit label matched a catalog string reading 'Importing...'
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 8f2a139e-fafd-44a3-a1be-a370cf1ac861
📒 Files selected for processing (8)
src/main/persistence/tracking-repos/project-host-compatibility.test.tssrc/main/persistence/tracking-repos/project-host-compatibility.tssrc/renderer/src/components/new-workspace/SetProjectLocationDialog.test.tsxsrc/renderer/src/components/new-workspace/SetProjectLocationDialog.tsxsrc/renderer/src/components/new-workspace/SetProjectLocationForms.tsxsrc/renderer/src/lib/project-host-setup-options.test.tssrc/renderer/src/lib/project-host-setup-options.tssrc/shared/project-host-setup-projection.ts
🚧 Files skipped from review as they are similar to previous changes (5)
- src/renderer/src/components/new-workspace/SetProjectLocationDialog.test.tsx
- src/renderer/src/lib/project-host-setup-options.ts
- src/renderer/src/lib/project-host-setup-options.test.ts
- src/renderer/src/components/new-workspace/SetProjectLocationDialog.tsx
- src/renderer/src/components/new-workspace/SetProjectLocationForms.tsx
Included review availability: Your plan includes up to 10 reviews per rolling hour; 5 remain after this review.
| it('drops a placeholder once a repo covers the same project and host', () => { | ||
| const merged = mergeProjectHostSetupCompatibilityState( | ||
| { projects: [], projectHostSetups: [pendingSetup()] }, | ||
| [repo({ id: 'local-repo' }), repo({ id: 'devbox-repo', executionHostId: 'ssh:devbox' })] | ||
| ) | ||
|
|
||
| expect(merged.projectHostSetups).toHaveLength(2) | ||
| expect(merged.projectHostSetups.every((setup) => setup.setupState === 'ready')).toBe(true) | ||
| expect(merged.projectHostSetups.map((setup) => setup.id)).toEqual(['local-repo', 'devbox-repo']) | ||
| }) |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Test project ID remapping before filtering.
This test does not create a project identity change. It cannot exercise the post-remap filter in src/main/persistence/tracking-repos/project-host-compatibility.ts Lines 51-59. A regression that filters before remapping would still pass.
Add a fixture with a successor repository identity and a pending setup on the same host. Assert that only the ready projected setup remains.
|
@nwparker we reverted #14868 in #14912 because setting a project location can change the selected folder or clone path before Orca uses it. Please reland with a fix that keeps the chosen path byte-for-byte. Reland ticket: https://linear.app/stably/issue/STA-4547/reland-14868-set-project-location-from-create-worktree-host-picker |
… picker (#14965) * feat(workspace): reland set project location from the create-worktree host picker Relands #14868 (reverted by #14912) with a fix for the regression that caused the revert: setting a project location could change the path before Orca used it. The retarget-after-setup path read the raw store record to find a just-created setup, because the memoized picker options had not refreshed yet: useAppStore.getState().projectHostSetups.find( (candidate) => candidate.id === setupId && candidate.setupState === 'ready' ) That hand-rolls a second selection path that skips every rule the option builder applies — repo eligibility, ephemeral-VM and runtime-owned SSH host exclusion, and the one-setup-per-host dedupe whose own comment notes that resolveWorkspaceCreationTarget takes the first project+host match and ignores the rest. So the composer could be retargeted at a setup other than the canonical one for that host, pointing creation at a different location than the one chosen. Resolves through buildProjectHostSetupOptions against fresh store state instead, so the fallback and the steady-state picker agree by construction. STA-4547 * fix(workspace): sanitize the clone prefill and drop an abandoned set-location Review follow-ups on this PR. The "Clone from URL" prefill seeded the field with the verbatim `git remote` URL, which can embed a PAT (`https://x-access-token:ghp_...@github.com/...`). The clone then runs on the *target* host, writing that token into its .git/config — a credential the user never typed into this flow, now readable by anyone on a shared host. Strip it with the same sanitizer `getProvisionedRootRecipeRepoUrl` already applies to the ephemeral-VM recipe URL. Extracted to resolveProjectCloneUrlPrefill so the rule is directly testable. The dialog also stays dismissable while a submit is in flight, and an SSH clone is unbounded. A clone the user backed out of minutes earlier still called onReady, silently moving the run target and resetting start-from under a form they had since pointed at another host. Drop the result if the dialog went away. * fix(workspace): re-arm the abandoned guard on mount StrictMode runs mount/cleanup/mount, so latching `abandoned` on the first cleanup left it true for the rest of the session and permanently suppressed onReady — the app wraps its root in StrictMode. Reset it on mount.
…icker (#14868) * feat(workspace): set project location from the create-worktree host picker Hosts that still say "Project location not set" now get an inline Set location action. It opens a nested dialog over Create worktree so the in-progress form stays put. * fix(workspace): replace unset-location status copy with a button Drop the redundant "Project location not set" caption and show a Set project location action with a hover tooltip instead. * refactor(workspace): tighten the set-project-location dialog - reuse CreateProjectParentBrowser instead of a second host-filesystem browse view - drop ProjectLocationBrowseTarget; parseExecutionHostId already models it - single setLocation path in RunTargetCombobox (row, button, Enter) - memoize the default clone URL instead of scanning on every store update - fix missing required props in the new composer-card test * fix(workspace): close the correctness gaps in set-project-location - Escape in the host browser now backs out to the form instead of dismissing the dialog and discarding the half-filled path/clone URL. Radix dismisses from a document-capture listener, so only preventDefault can stop it. - Drop the stopPropagation guards: window-capture (the composer's Escape handler) already ran by then, so they never protected it — the nestedDialogOpen gate does. They did silently kill RemoteFileBrowser's own key handling. - Hide Set project location for host-local repo:<id> projects (folder projects, git repos with no remote). Linking on another host matches by project identity, which those have none of, so the call could only ever toast an error. - Drop a standalone placeholder setup once a repo projection covers the same project+host, restoring the (projectId, hostId) uniqueness invariant. Setting a location on a host with a pending setup was leaving a ghost that sorts first and reads back as 'not set up'. - Existing-folder submit label matched a catalog string reading 'Importing...' * test(composer): follow the renamed local in the host-retarget source assertion
… picker (#14965) * feat(workspace): reland set project location from the create-worktree host picker Relands #14868 (reverted by #14912) with a fix for the regression that caused the revert: setting a project location could change the path before Orca used it. The retarget-after-setup path read the raw store record to find a just-created setup, because the memoized picker options had not refreshed yet: useAppStore.getState().projectHostSetups.find( (candidate) => candidate.id === setupId && candidate.setupState === 'ready' ) That hand-rolls a second selection path that skips every rule the option builder applies — repo eligibility, ephemeral-VM and runtime-owned SSH host exclusion, and the one-setup-per-host dedupe whose own comment notes that resolveWorkspaceCreationTarget takes the first project+host match and ignores the rest. So the composer could be retargeted at a setup other than the canonical one for that host, pointing creation at a different location than the one chosen. Resolves through buildProjectHostSetupOptions against fresh store state instead, so the fallback and the steady-state picker agree by construction. STA-4547 * fix(workspace): sanitize the clone prefill and drop an abandoned set-location Review follow-ups on this PR. The "Clone from URL" prefill seeded the field with the verbatim `git remote` URL, which can embed a PAT (`https://x-access-token:ghp_...@github.com/...`). The clone then runs on the *target* host, writing that token into its .git/config — a credential the user never typed into this flow, now readable by anyone on a shared host. Strip it with the same sanitizer `getProvisionedRootRecipeRepoUrl` already applies to the ephemeral-VM recipe URL. Extracted to resolveProjectCloneUrlPrefill so the rule is directly testable. The dialog also stays dismissable while a submit is in flight, and an SSH clone is unbounded. A clone the user backed out of minutes earlier still called onReady, silently moving the run target and resetting start-from under a form they had since pointed at another host. Drop the result if the dialog went away. * fix(workspace): re-arm the abandoned guard on mount StrictMode runs mount/cleanup/mount, so latching `abandoned` on the first cleanup left it true for the rest of the session and permanently suppressed onReady — the app wraps its root in StrictMode. Reset it on mount.
…icker (stablyai#14868) * feat(workspace): set project location from the create-worktree host picker Hosts that still say "Project location not set" now get an inline Set location action. It opens a nested dialog over Create worktree so the in-progress form stays put. * fix(workspace): replace unset-location status copy with a button Drop the redundant "Project location not set" caption and show a Set project location action with a hover tooltip instead. * refactor(workspace): tighten the set-project-location dialog - reuse CreateProjectParentBrowser instead of a second host-filesystem browse view - drop ProjectLocationBrowseTarget; parseExecutionHostId already models it - single setLocation path in RunTargetCombobox (row, button, Enter) - memoize the default clone URL instead of scanning on every store update - fix missing required props in the new composer-card test * fix(workspace): close the correctness gaps in set-project-location - Escape in the host browser now backs out to the form instead of dismissing the dialog and discarding the half-filled path/clone URL. Radix dismisses from a document-capture listener, so only preventDefault can stop it. - Drop the stopPropagation guards: window-capture (the composer's Escape handler) already ran by then, so they never protected it — the nestedDialogOpen gate does. They did silently kill RemoteFileBrowser's own key handling. - Hide Set project location for host-local repo:<id> projects (folder projects, git repos with no remote). Linking on another host matches by project identity, which those have none of, so the call could only ever toast an error. - Drop a standalone placeholder setup once a repo projection covers the same project+host, restoring the (projectId, hostId) uniqueness invariant. Setting a location on a host with a pending setup was leaving a ghost that sorts first and reads back as 'not set up'. - Existing-folder submit label matched a catalog string reading 'Importing...' * test(composer): follow the renamed local in the host-retarget source assertion
… picker (stablyai#14965) * feat(workspace): reland set project location from the create-worktree host picker Relands stablyai#14868 (reverted by stablyai#14912) with a fix for the regression that caused the revert: setting a project location could change the path before Orca used it. The retarget-after-setup path read the raw store record to find a just-created setup, because the memoized picker options had not refreshed yet: useAppStore.getState().projectHostSetups.find( (candidate) => candidate.id === setupId && candidate.setupState === 'ready' ) That hand-rolls a second selection path that skips every rule the option builder applies — repo eligibility, ephemeral-VM and runtime-owned SSH host exclusion, and the one-setup-per-host dedupe whose own comment notes that resolveWorkspaceCreationTarget takes the first project+host match and ignores the rest. So the composer could be retargeted at a setup other than the canonical one for that host, pointing creation at a different location than the one chosen. Resolves through buildProjectHostSetupOptions against fresh store state instead, so the fallback and the steady-state picker agree by construction. STA-4547 * fix(workspace): sanitize the clone prefill and drop an abandoned set-location Review follow-ups on this PR. The "Clone from URL" prefill seeded the field with the verbatim `git remote` URL, which can embed a PAT (`https://x-access-token:ghp_...@github.com/...`). The clone then runs on the *target* host, writing that token into its .git/config — a credential the user never typed into this flow, now readable by anyone on a shared host. Strip it with the same sanitizer `getProvisionedRootRecipeRepoUrl` already applies to the ephemeral-VM recipe URL. Extracted to resolveProjectCloneUrlPrefill so the rule is directly testable. The dialog also stays dismissable while a submit is in flight, and an SSH clone is unbounded. A clone the user backed out of minutes earlier still called onReady, silently moving the run target and resetting start-from under a form they had since pointed at another host. Drop the result if the dialog went away. * fix(workspace): re-arm the abandoned guard on mount StrictMode runs mount/cleanup/mount, so latching `abandoned` on the first cleanup left it true for the rest of the session and permanently suppressed onReady — the app wraps its root in StrictMode. Reset it on mount.








ELI5
If a host in Create worktree has no folder for this project, you now get a Set project location button on that row. Hover explains it; click opens a second dialog on top so you can pick a folder or clone without losing the Create worktree form.
What Changed
Why
The only path to set a host location was Settings, which closed Create worktree and threw away the in-progress form. A connected host with no project path had no in-place next step.
Linked Issue
N/A — requested from the Create worktree host picker screenshot.
Visual Proof
Before — host shows “Project location not set” with no in-place action:
After — the status copy is gone; the row has a Set project location button:
After hover — tooltip explains the next step:
After click — set-location dialog stacks over Create worktree:
Testing
Verified in the Electron app on macOS:
Automated coverage: host option
canSetLocationflags, dialog browse/clone/save, and composer stay-open wiring.SSH / runtime hosts browse through the existing host filesystem picker. Local hosts use the native folder picker. Folder projects hide clone.
Escape inside the host browser backs out to the form rather than dismissing the dialog (covered by a test).
Review
SSH, runtime, and local path picking are all covered. Folder workspaces still hide the Run on picker.
Review pass found four things worth calling out:
repo:<id>project id (a folder project, or a git repo with no remote) is a per-host repo id that can never match on the target —linkRepoToProjectHostSetupwould always throw.canSetLocationnow excludes those, so such rows keep the plain "Project location not set" status line instead of a button that only ever toasts an error. Settings already hides its equivalent surface for folder repos.preventDefault()stopsonDismiss. ThestopPropagation()guards were doing nothing for the composer (its Escape handler is window-capture, which had already run — thenestedDialogOpengate is what protects it) while silently killingRemoteFileBrowser's own key handling.(projectId, hostId)uniqueness invariant the codebase asserts elsewhere; the ghost sorts first, so Settings read the configured host back as "not set up" andresolveWorkspaceCreationTargetcould returnsetup-not-ready. Fixed at the merge choke point, so it covers the CLI path too and self-heals profiles that already carry one.'Adding...'while its catalog string reads"Importing..."— the default was dead and disagreed with what users saw.No wire change: this is renderer-only apart from the persistence merge predicate, which is local state reconciliation.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)