Skip to content

feat(web): add a project to a named machine in one click when there is nothing to decide - #1650

Open
incognitojam wants to merge 22 commits into
mainfrom
styal/one-click-add-to-machine
Open

incognitojam wants to merge 22 commits into
mainfrom
styal/one-click-add-to-machine

Conversation

@incognitojam

@incognitojam incognitojam commented Nov 19, 2026 •

Copy link
Copy Markdown
Owner

Note

Picking Add to build-server in the machine menu starts the clone straight away when there is nothing to decide, and the composer shows its progress from the click. The dialog still opens when .env-style files would be copied, the folder already exists, the checks fail or cannot run, or they take more than 3 seconds.

Adding a project to another machine always opened a dialog. Usually every field in it was already right and there was nothing to decide, but adding still took an extra screen and another click.

The composer's machine menu, both in a new thread and in a project's chat, now lists each machine the project could go to as an action below a divider, with the folder the clone will land in beneath it. Add with options… opens the full dialog. Settings → Projects → Checkouts keeps opening the dialog.

When you pick Add to build-server What happens
No ignored file would be copied by default, and the folder does not exist there The composer shows Adding to build-server · Preparing… with Cancel, and the same row becomes the clone's progress. No dialog.
.env, .env.*, .envrc or .dev.vars would be copied The dialog opens and says the ticked files will be copied there. Copying secrets to another machine stays a question.
The folder already exists on that machine The dialog opens with a warning under the folder field.
Ignored files cannot be listed (git fails, or the machine cannot list them) The dialog opens with a warning that no files will be copied.
Checking the folder fails, or the checks take more than 3 seconds The dialog opens.
The clicked machine disconnects while checking The dialog opens, offering the machines that remain. One click never clones to a different machine.
Any add while a one-click add is being decided or its request is out Every one-click Add to … row in every composer is disabled, with "Preparing…" beneath. Add with options… and the Add to … button in Settings → Projects are disabled too. Only the composer that started the add shows its row with Cancel, and only while its draft is still on the project being added. That draft is the one that moves to the clone. Nothing queues, and nothing moves between composers.
The composer has no draft, such as an existing thread's The dialog opens. One click needs a draft: it is what moves to the clone and shows the row.
The clone request itself is slow to come back Cancel stays on the row. What happens next depends on where the clone got to, below.
The clone fails The cloned project's composer shows the error with Retry and Remove project, as before.

Add with options… and the Settings button are disabled rather than left open because they open the same dialog the one-click add uses while it decides; opening it would replace that add.

The rows come back when the add ends: its dialog closes, its clone is listed, its start fails (the dialog then shows why), or a cancel has settled. A request that never answers cannot hold them forever. Reading the files to copy, the start request, and the cancel's own requests each count as failed after 30 seconds, and waiting for the clone to be listed was already capped at 10 seconds. So the longest the rows can stay disabled without a dialog on screen is about 70 seconds.

Cancelling after the clone request went out, from the row or by closing the dialog after Clone. The row goes at once; the Add rows stay disabled until the cancel has settled, so a new add cannot start while the old one is still being cleared away. If the start request then goes unanswered, the notice says the project may still be there. The client acts only on a clone this add started:

Where the clone is when the cancel arrives What happens
Still running, in a project this add created The clone is cancelled, which deletes the partial checkout, and the project record is removed.
Already finished, or finishes while being cancelled Kept. A notice says the project was added and was kept, so no folder is left without a project.
The machine already had the project (the server reused it) Nothing is cancelled or removed, so a clone another client started is never stopped. A notice says the project stays.
Any step fails or cannot be confirmed A notice says the project may still be there, as a project or as its folder.

Two server behaviours this PR does not change: discarding a partial clone leaves the destination as an empty folder, as Cancel then Remove project in the composer does today; and the server does not report a partial checkout it fails to delete (for example on a permissions error), so the client cannot tell the person about it.

One click counts only checks answered after the click, so a cached answer from an earlier dialog cannot skip a question. Once the dialog has shown, only its Clone button starts the clone.

Server change. A listing of ignored files that git could not make used to come back as an empty list, which looked like "nothing to copy". The result now carries an optional failed flag. Older clients ignore the flag. A new client talking to an older server cannot tell a failed listing from "no files", so one click there can still leave .env behind until that server updates.

Clone protocol. One click keeps the protocol of the source checkout's remote. When the target rejects SSH, the server already retries over HTTPS. This was run, not only read from the code: build-server ran with SSH set up to be rejected (no usable key, no agent) and a git wrapper on its PATH that logs each command and its exit status. One click on a project whose remote is git@github.com:octocat/Hello-World.git logged:

19:31:18.419 start: git clone --progress -- git@github.com:octocat/Hello-World.git Hello-World
19:31:18.975 exit 128: git clone --progress
19:31:18.989 start: git clone --progress -- https://github.com/octocat/Hello-World.git Hello-World
19:31:19.514 exit 0: git clone --progress

The clone on build-server ended up with origin set to https://github.com/octocat/Hello-World.git.

Upstream. Two open upstream PRs change this dialog and will need a hand merge at intake: pingdotgg#31106 (choices for an existing folder) and pingdotgg#34412 (mobile entry point, and moves the copy relay into client-runtime).

The machine menu:

The machine menu: Add to build-server with its folder beneath, Add with options…, below a divider

The same menu in dark mode:

The machine menu in dark mode

The menu on a narrow composer:

The narrow composer menu: Run on, then the Add rows, then Workspace

One click with nothing to decide, right after the click, in the hello-world thread that started it:

hello-world new thread on studio-mac: Adding to build-server, Preparing…, Cancel

Meanwhile, in another composer (a spoon-knife new thread), both Add rows are disabled with "Preparing…" beneath, and there is no status row:

spoon-knife composer menu: Add to build-server and Add with options… disabled, Preparing… beneath

The hello-world thread once the clone starts, now on build-server (cropped to the composer's lower edge):

build-server chip and the row: Cloning Hello-World, Connecting, Cancel

.env files would be copied, so it asks:

Dialog: the ticked files will be copied to build-server

A clone that fails, with Retry:

build-server chip and the row: Failed to clone styal-fixture-does-not-exist, Git authentication failed, Remove project, Retry

Preparing… in dark mode:

Adding to build-server, Preparing…, Cancel, dark

The .env dialog in dark mode:

The .env dialog, dark

The existing-folder warning, light and dark:

Folder warning with an icon, light

Folder warning with an icon, dark

Ignored files could not be listed, light and dark:

Could not list the files git ignores on studio-mac, light

Could not list the files git ignores on studio-mac, dark

The project chat's menu:

The project chat's menu with Add to build-server

After picking Add to build-server in the project chat, it is on build-server and shows the clone (cropped to the composer's lower edge):

Project chat: build-server chip and the row: Cloning Hello-World, Connecting, Cancel

How this was checked: against a production build of the web client, on an isolated server ("studio-mac") with a second local server connected as "build-server", both using synthetic data. The projects are clones of octocat/Hello-World and octocat/Spoon-Knife, plus a project whose remote repository does not exist.

  • New thread, nothing to decide, production build, timings from the page (PerformanceObserver long tasks over 50 ms, composer row polled every 20 ms):

    first click after loading the page:
      click handler 8 ms; Preparing… at 218 ms; Cloning · Connecting at 1349 ms; done at 3432 ms
      long tasks: 134 ms at the click, 64 ms at 133 ms, then 154 / 124 / 58 ms from 977 ms
    next click:
      click handler 3 ms; Preparing… at 44 ms; Cloning · Connecting at 409 ms; done at 1693 ms
      long tasks: none
    

    The first click loads code the page has not used yet. The tasks around 1 s are the composer switching to the new project on build-server, the same work as picking a project by hand. Nothing blocks for half a second; the roughly 580 ms seen earlier came from the development build.

  • Project chat: "Preparing…" at 86 ms, then the header and row switched to build-server at 235 ms with the typed message kept.

  • Cancel: clicked during "Preparing…" at about 0.2 s. The row went away, the draft stayed on studio-mac, and nothing was cloned. A new pick afterwards cloned as normal.

  • One add at a time: hello-world was picked in its new thread, and the spoon-knife thread's menu was opened 0.7 s later. Both its Add rows reported aria-disabled=true with "Preparing…" from 724 ms after the click until 3485 ms, when hello-world's clone was listed, and then came back enabled. The spoon-knife composer showed no status row.

  • Rows freed by the dialog: when the checks took over 3 seconds and the dialog opened, closing it with Cancel left both rows enabled again.

  • Asking: the .env and existing-folder cases opened the dialog as captured. The failure case ended on "Failed to clone … Git authentication failed" with Retry.

  • Tests: a server test covers the failed flag (and an existing server test covers cancel deleting the partial checkout); unit tests cover the four cancel outcomes above; unit tests cover the decision table, freshness, and mapping a failed or unsupported listing to a question; unit tests cover a start request or a cancel that is never answered failing after 30 seconds; browser tests cover any other add (another machine, another draft, or the dialog) being ignored while one is decided, the status row showing only while its draft is on the project being added, the rows freed when the project vanishes or the start fails, the rows staying disabled until a cancelled request settles, a dialog that remounts while its clone request is out starting no second clone and keeping that request's "Starting…", error and Cancel, the notice when a cancelled start goes unanswered, and closing the dialog after Clone, with its Cancel button or Escape, cancelling and removing that clone.

  • Captures that needed time: a git wrapper on studio-mac paused the ignored-file listing for 2.6 s (under the 3-second limit), or made it fail, so the disabled rows and the failed-listing warning could be captured.

Not exercised at runtime: the 3-second timer itself; the 30-second limits on a request that never answers; the disabled Settings button; the status row hiding when its draft is switched to another project. Each is covered by the tests above.

In the narrow menu capture, the grey background on "studio-mac" and "New worktree" is the menu's existing style for the checked item in each group (data-checked), unchanged here.

Paths in captures are rewritten to /Users/dev. Captures of a composer on build-server are cropped to its lower edge: that fixture runs with a scratch home folder and no provider sign-in, so its composer shows Open provider settings.


Written by claude/claude-opus-5-5, reviewed by codex/gpt-6-astra, in styal 🧵.

@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Upstream divergence

Both sides are compared with upstream at the in-order tip 9f4b42e750. Excludes .repos/ and pnpm-lock.yaml.

Measure Base This PR Change
Upstream files the fork changes 2,310 2,316 +6
Lines changed in them 158,711 159,798 +1,087
Upstream files the fork removes 71 71 0
Fork-only files 1,006 1,008 +2
Fork-only lines 183,810 184,037 +227

Upstream files that start to differ (6)

  • apps/server/src/workspace/WorkspaceEntries.test.ts: +14 −0 from upstream
  • apps/web/src/components/AddProjectToMachineDialog.browser.test.tsx: +390 −4 from upstream
  • apps/web/src/components/BranchToolbar.logic.ts: +0 −4 from upstream
  • apps/web/src/components/chat/useProjectCloneBanner.tsx: +33 −9 from upstream
  • apps/web/src/components/ui/select.tsx: +11 −0 from upstream
  • apps/web/src/hooks/useAddProjectTargets.ts: +39 −3 from upstream
Upstream files whose difference changes (9)
File Change Now differs by
apps/web/src/components/AddProjectToMachineDialog.tsx +299 336 lines
apps/web/src/lib/addProjectToMachine.ts +107 150 lines
apps/web/src/components/BranchToolbarEnvironmentSelector.tsx +95 97 lines
apps/web/src/components/BranchToolbar.tsx +58 127 lines
docs/user/thread-sidebar.md +8 191 lines
apps/web/src/components/ChatView.tsx +6 786 lines
apps/web/src/components/settings/ProjectSettingsPanel.tsx +3 449 lines
apps/server/src/workspace/WorkspaceEntries.ts +2 4 lines
packages/contracts/src/project.ts +2 19 lines

@incognitojam
incognitojam marked this pull request as ready for review November 19, 2026 18:34
@incognitojam
incognitojam force-pushed the styal/one-click-add-to-machine branch from 68d8309 to 41a65cc Compare November 19, 2026 19:00
@github-actions github-actions Bot added size:XL and removed size:L labels Nov 19, 2026
@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

ℹ️ The exact PR base did not have a successful artifact. Baseline uses the latest successful main measurement shown below.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 5.0 KiB 5.0 KiB 0 B (0.0%) 6.8 KiB ✅
Codex Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅
Codex Live turn WebSocket wire 1.2 KiB 1.2 KiB 0 B (0.0%) 2.0 KiB ✅
Codex Live turn WebSocket decoded 21.5 KiB 21.5 KiB 0 B (0.0%) 24.4 KiB ✅
Codex Live turn messages 1 1 0 (0.0%) 8 ✅
Claude Total thread wire 5.0 KiB 5.0 KiB 0 B (0.0%) 6.8 KiB ✅
Claude Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅
Claude Live turn WebSocket wire 1.2 KiB 1.2 KiB 0 B (0.0%) 2.0 KiB ✅
Claude Live turn WebSocket decoded 21.9 KiB 21.9 KiB 0 B (0.0%) 24.4 KiB ✅
Claude Live turn messages 1 1 0 (0.0%) 8 ✅

Baseline: 6776e16 · PR result: 629fb1c · Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 108.5 KiB
  • Claude decoded thread snapshot: 108.8 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

…s one pick at a time, and reads as an action
… can always be cancelled, and warns about an existing folder
…ops another client's, and the refusal names its add
…nt add waits its turn instead of being refused
…s a clone being sent, and the row follows the machine chosen in the dialog
@incognitojam
incognitojam force-pushed the styal/one-click-add-to-machine branch from dd3faca to 629fb1c Compare November 19, 2026 23:17
@github-actions

Copy link
Copy Markdown

This PR changes the test suite by +21 test cases (browser +9, unit +11, server +1).

Keep tests that would fail for a real reason, and test logic below the UI where it can be. See Testing.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant