feat(mobile,trpc): create cloud workspaces from the phone
Links
- Decision log:
apps/mobile/plans/20260817-cloud-workspaces.md(PR B section) - Predecessor: #6596 (list/open/terminal/actions)
Summary
- Create a cloud workspace from the mobile composer: the project sheet gains a Cloud section (API-listed projects, available with zero machines online), branches come from the GitHub remote via the App installation, and submit is one call —
cloudWorkspace.createreturns the provisioning row, the cloud list is seeded, and the app navigates straight into the provisioning screen. - Two interim API procedures, fenced until the environments entity:
cloudWorkspace.listProjects(thev2_projectsrows that still resolve to a repo) andcloudWorkspace.listBranches(App-token branch listing that degrades to the default branch when the installation can't be authenticated, instead of breaking the picker).
How It Works
NewChatTargetgainskind: "host" | "cloud"; cloud targets come fromuseCloudProjectsunder the same flag + FORBIDDEN gating as the cloud list, keyed by theCLOUD_TARGET_IDsentinel (desktop'sCLOUD_HOST_ID).- The project sheet is sectioned: Cloud first (it is never offline), then each online machine. The composer chip reads "Project · Cloud"; the agent chip is hidden for cloud targets (create launches nothing — the prompt feeds the server-side auto-name; the sandbox-side launch is a follow-up).
- The branch chip and branch sheet read
listBranchesfor cloud targets; host targets are unchanged. - Submit routes cloud targets to
useCreateCloudWorkspace: one mutation, seedcloudWorkspace.list,router.push— same shape as desktop's #6566. Attachments are refused with a clear error (host-bound today; blob-backed attachments are the follow-up).
Manual QA (on the iPhone 16e simulator against the local API and real Blaxel sandboxes)
- Composer defaults to "Superset · Cloud" with branch
mainwhen no machine is online; agent chip hidden - Project sheet: CLOUD section header + API projects; picking one updates the chip
- Send → row created (
provisioning), server auto-named it from the prompt ("Mobile Flow Test"), immediate navigation to the provisioning screen → flipped toready→ workspace opened - In the phone-created sandbox (fresh
superset-hostsvcimage): Start a session → Claude boots with "bypass permissions on", no root refusal; composer prompt answered (mobile-e2e-ok) - Test workspace deleted after; branch listing verified to degrade (local App/installation mismatch) rather than 500
Testing
bunx tsc --noEmit(mobile, trpc)bun run lint
Known Limitations
listProjectsreads retiredv2_projects(fenced; replaced by the environments entity). Projects created since the sync era won't appear until then.- Cloud attachments unsupported (SUPER-1915 / blob follow-up).
- The project sheet's checkmark falls back to the alphabetical first target when preferences haven't hydrated — pre-existing sheet behavior, chip is authoritative.
Also in this PR
- Sandbox image
superset-hostsvcwas rebuilt from main and deployed (operational, no code): new sandboxes now run the merged host-service, which is what activated the Claude-as-root fix verified above.
Summary by cubic
Create cloud workspaces from the mobile composer. Previously mobile could only create on an online host; now users can choose a cloud project, pick a branch from GitHub, and submit one call that creates the provisioning row and navigates to the workspace. Agent picker is hidden for cloud targets; attachments are rejected.
-
New cloud target in the composer: project sheet is sectioned (Cloud first, then each online machine). The project chip shows “Project · Cloud”.
-
Branch picker uses
cloudWorkspace.listBranchesfor cloud targets. It lists from the GitHub App installation and falls back to the default branch if the installation can’t be authenticated. Host targets are unchanged. -
Create uses
useCreateCloudWorkspace: callscloudWorkspace.create, seeds the cloud list cache to avoid a provisioning/not-found flash, and routes to the workspace. -
Feature flag
FEATURE_FLAGS.CLOUD_WORKSPACESgates cloud data. AFORBIDDENresponse is treated as “no projects,” not an error. Cloud projects load viauseCloudProjects. -
TRPC: adds
cloudWorkspace.listProjects(interim,v2_projectswith a repo) andcloudWorkspace.listBranches; server implementslistRemoteBranches. -
Review and rollout
- No migrations. Cloud attachments are not supported yet; the create path blocks them with a clear error.
- Known interim:
listProjectsonly returnsv2_projectsthat still resolve to a repo; newer projects arrive with the environments entity.
Summary by CodeRabbit
- New Features
- Added Cloud workspace targets to New Chat.
- Browse Cloud projects and Git branches, with Cloud projects grouped separately from host projects.
- Create a Cloud workspace directly from New Chat and continue in the new workspace.
- Added branch search with default branches prioritized.
- Added clearer empty states and Cloud-specific progress and error handling.
- Bug Fixes
- Improved handling when Cloud access or project data is unavailable.
- Documentation
- Documented Cloud workspace verification results.