Skip to content

feat(workspace): set project location from the create-worktree host picker - #14868

Merged
nwparker merged 5 commits into
mainfrom
nwparker/project-location-not-set
Aug 16, 2026
Merged

nwparker merged 5 commits into
mainfrom
nwparker/project-location-not-set

Conversation

@nwparker

@nwparker nwparker commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​528 $\color{#cf222e}{\Huge{\mathbf{−}}}$​9 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​519
Prod 12 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​715 $\color{#cf222e}{\Huge{\mathbf{−}}}$​17 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​698

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

  • Available hosts without a project path show an inline Set project location button (the old “Project location not set” caption is gone; hover shows a tooltip).
  • The button opens a nested Set project location dialog (browse existing folder or clone from URL).
  • Closing that dialog with Escape / the X / outside click leaves Create worktree open.
  • After a successful setup, the new host is selected so you can create the worktree immediately.

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:

Before: Project location not set with no action

After — the status copy is gone; the row has a Set project location button:

After: Set project location button

After hover — tooltip explains the next step:

After: tooltip on Set project location

After click — set-location dialog stacks over Create worktree:

After: Set project location dialog stacked over Create worktree

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

Verified in the Electron app on macOS:

  1. Open Create worktree for a project that has at least one ready host and one connected host with no path.
  2. Open Run on.
  3. Confirm the unset host no longer says “Project location not set” and has a Set project location button.
  4. Hover the button and confirm the tooltip.
  5. Click the button and confirm Create worktree stays open behind the new dialog.
  6. Press Escape. Confirm only the set-location dialog closes.

Automated coverage: host option canSetLocation flags, 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:

  • Host-local projects can't be set up on another host. Linking matches by project identity, and a 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 — linkRepoToProjectHostSetup would always throw. canSetLocation now 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.
  • Escape in the host browser discarded the whole form. Radix dismisses from a document-capture listener, so the browse view could never intercept it; only preventDefault() stops onDismiss. The stopPropagation() guards were doing nothing for the composer (its Escape handler is window-capture, which had already run — the nestedDialogOpen gate is what protects it) while silently killing RemoteFileBrowser's own key handling.
  • Setting a location on a host with a pending setup left a ghost. It projected a ready setup alongside the standalone placeholder, breaking the (projectId, hostId) uniqueness invariant the codebase asserts elsewhere; the ghost sorts first, so Settings read the configured host back as "not set up" and resolveWorkspaceCreationTarget could return setup-not-ready. Fixed at the merge choke point, so it covers the CLI path too and self-heals profiles that already carry one.
  • The existing-folder submit label's inline default said '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

  • This PR is small and focused
  • I explained what changed and why (including ELI5)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

…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.
@nwparker
nwparker requested a review from brennanb2025 as a code owner August 16, 2026 08:41
@coderabbitai

coderabbitai Bot commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6f091405-2164-4317-881b-f1a721b627be

📥 Commits

Reviewing files that changed from the base of the PR and between 6852e8c and 43e4c3f.

📒 Files selected for processing (1)
  • src/renderer/src/hooks/useComposerState-host-retarget.test.ts

Included review availability: Your plan includes up to 10 reviews per rolling hour; 5 remain after this review.


📝 Walkthrough

Walkthrough

Adds 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)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The description is detailed and covers the change, rationale, visual proof, testing, and checklist, but it marks the required Linked Issue as N/A. Add the issue reference in the Linked Issue section and complete the required template sections, including AI Disclosure and Agent skill upstream boundary.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the primary change: adding project-location setup from the Create worktree host picker.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between fd1dba9 and a4141ba.

📒 Files selected for processing (15)
  • src/renderer/src/components/NewWorkspaceComposerCard.set-location.test.tsx
  • src/renderer/src/components/NewWorkspaceComposerCard.test.tsx
  • src/renderer/src/components/NewWorkspaceComposerCard.tsx
  • src/renderer/src/components/NewWorkspaceComposerModal.tsx
  • src/renderer/src/components/new-workspace/RunTargetCombobox.tsx
  • src/renderer/src/components/new-workspace/RunTargetComboboxRow.tsx
  • src/renderer/src/components/new-workspace/SetProjectLocationDialog.test.tsx
  • src/renderer/src/components/new-workspace/SetProjectLocationDialog.tsx
  • src/renderer/src/components/new-workspace/SetProjectLocationForms.tsx
  • src/renderer/src/components/new-workspace/set-project-location-browse.test.ts
  • src/renderer/src/components/new-workspace/set-project-location-browse.ts
  • src/renderer/src/hooks/useComposerState.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/lib/project-host-setup-options.test.ts
  • src/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.

@nwparker

Copy link
Copy Markdown
Contributor Author

/visual-proof

Before

Before: Project location not set with no action

After — Set location button

After: Set location button on the unset host

After — stacked modal (Create worktree stays open)

After: Set project location dialog stacked over Create worktree

After Escape — Create worktree remains

After: Create worktree remains after closing set-location

Drop the redundant "Project location not set" caption and show a Set project location action with a hover tooltip instead.
@nwparker

Copy link
Copy Markdown
Contributor Author

/visual-proof

Updated after tightening the row.

Before

Before: Project location not set with no action

After — button only

After: Set project location button

After — hover tooltip

After: tooltip on Set project location

After — stacked dialog

After: Set project location dialog stacked over Create worktree

- 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...'

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 1b549ab and 6852e8c.

📒 Files selected for processing (8)
  • src/main/persistence/tracking-repos/project-host-compatibility.test.ts
  • src/main/persistence/tracking-repos/project-host-compatibility.ts
  • src/renderer/src/components/new-workspace/SetProjectLocationDialog.test.tsx
  • src/renderer/src/components/new-workspace/SetProjectLocationDialog.tsx
  • src/renderer/src/components/new-workspace/SetProjectLocationForms.tsx
  • src/renderer/src/lib/project-host-setup-options.test.ts
  • src/renderer/src/lib/project-host-setup-options.ts
  • src/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.

Comment on lines +46 to +55
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'])
})

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 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
nwparker merged commit e4e54a1 into main Aug 16, 2026
45 checks passed
@AmethystLiang

Copy link
Copy Markdown
Contributor

@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

nwparker added a commit that referenced this pull request Aug 16, 2026
… 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.
AmethystLiang pushed a commit that referenced this pull request Aug 17, 2026
…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
AmethystLiang pushed a commit that referenced this pull request Aug 17, 2026
… 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.
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…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
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
… 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants