Cloud start: picking Cloud grants the chip's folder; refusals before Cloud agree

Merged
TE
3d ago
+66-9

Leo, on the "The app refused the agent connection." card under a failed "Set up a Cloud machine" step: "what happened here on this build?"

Follows #34406, which explained the refusal. This PR removes its cause and folds in that PR's review follow-ups.

Cause

The New Tab folder chip can name a recent project nobody clicked (NewTabScreen.tsx: project = none ? undefined : (recent ?? seeded)). Only a click on a project (onProjectPicked → workspace.useFolder) grants it, so a Cloud send of the chip's folder was refused by AgentPaneCloudStart.folderInScope with transport.path_outside_roots, by design: Cloud copies the folder off this Mac.

Change

  • New Tab: picking Cloud in Run as is the person's pick of the chip's folder. runMode.onMode grants envFolder through onProjectPicked on that click.
  • Composer: its Run as Cloud row grants the folder sendToCloud names (composerModeRows, pickFolder). Home and above, and agent-home, ask nothing (cloudStartFolder).
  • folderInScope is not widened. A Cloud mode that came on by itself through the folder default, with no pick, still gets the host's refusal, which #34406 now words "This folder isn't open in this tab; pick it to send it to Cloud." with no step marked failed. I didn't add a second check on the page: it can't see the pane's roots, so it would also refuse a tab whose own workspace folder is a root.

#34406 review follow-ups

  • Web refusedHere now uses Swift's list (cloud_attachments, unsupported, unavailable_now, sandbox_busy, sandbox_spent), so an attachment refusal no longer marks "Set up a Cloud machine" failed.
  • unavailable_now and the sandboxRuns refusal are logged under app.cloud, as "refused on this Mac before it reached Cloud (nothing was sent)".
  • Swift test aRefusalHereIsTheRefusedHereCode, plus web tests in cloudStartProgress.test.ts.

Risk: low. A Cloud pick now grants the one folder the chip names, which a click on that project already granted.

Agent session: agent session

šŸ¤– Generated with Claude Code