Cloud start: the composer's folder starts on the Send's gesture, never home or above

Merged
TE
2d ago
+64-73

Leo, on a nightly (4178064067101, bd14c57): a new Cloud chat sat on "Initializing session" with none of its steps started, then said:

This folder isn't open in this tab; pick it to send it to Cloud.

and he asked: "what's this"

The composer's folder chip showed a folder inside a Git working copy (a repo's briefs/<lane> subfolder).

Root cause

AgentPaneHandOff.cloudChecked (AgentPaneCloudStart.swift) let a Cloud start copy a folder only when the folder, and also the Git working copy that holds it (what the copy uploads), was under one of the tab's roots. A tab in a repo's subfolder has only that subfolder as a root, so the working-copy check failed with transport.path_outside_roots; a recent project the New Tab chip shows without a click was refused the same way, unless Cloud was clicked in Run as (#34415).

Fix

The Send's gesture (held, unchanged) is the pick of the composer's folder, as it already is for a typed folder of a chat that starts on this Mac (grantTypedFolders). The Cloud start no longer requires the folder, its working copy or its git folders to be among the tab's roots; each must still be a real folder that is never home or above it, and nothing is copied without the gesture. folderInScope becomes copyableFolder.

The changed tests (AgentPaneCloudStartTests):

  • aFolderInsideAGitWorkingCopyStartsInCloudAndCopiesTheWorkingCopy: Leo's case. The tab's root is the subfolder; the start succeeds and uploads the working copy.
  • theComposersFolderStartsInCloudOnTheSendsGestureButNeverHomeOrAbove: a folder outside the roots, a link to one, and a .. path start. A missing folder, /, home and above home are refused, and so is any start without the gesture.
  • aWorkingCopyWhoseGitFolderIsHomeOrAboveIsNeverCopied: a linked worktree's git folders are copied, but a commondir that names / is refused.
  • aScannedProjectTheChipShowsStartsInCloudOnTheSendsGesture.

These replace the tests that asserted the old rule (an outside folder, a subfolder of a working copy, and a scanned project the Send did not pick were all refused).

Regression command: cmux-ci run --class light --script scripts/ci/package-test-lane.sh --arg suite --arg Packages/macOS/CmuxNext --arg AgentPaneCloudStartTests. It runs at 27cce7f (the tests alone, expected red) and at the head (expected green); results are posted in a comment.

Observed / Not run

  • Observed: prepush-gate.py shows no new violations.
  • Not run: a nightly start of a real Cloud chat (it will be checked on the next nightly).

Changelog

  • Fixed: A Cloud chat started from a folder inside a Git repository, or from a recent project, no longer stops with "This folder isn't open in this tab".

Agent session: agent session

🤖 Generated with Claude Code


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

Fixes Cloud chat starts being refused with "This folder isn't open in this tab" when the composer's folder was inside a Git working copy or was a recent project the New Tab chip showed without a click.

The Send's gesture (held) is now what picks the composer's folder for a Cloud start, matching how a typed folder works for a chat that starts on this Mac. The folder, its Git working copy, and the copy's git folders no longer need to be among the tab's roots; each must still be a real folder that is never home or above it, and nothing is copied without the Send's gesture.