Cloud start-chat: a personal send from a repository folder gets the platform's set-up workspace machine

Merged
TE
4d ago
+245-32

Summary

Wires zero-setup hot start (cmuxterm-hq#5846, item 2) into the App's first Cloud send. #30414 added the cmux-tui pieces.

  • cmux-tui start-chat plan: when a send needs a new machine, its folder has a GitHub origin, the account is the personal one (the App spells it user/, and workspace machines live in the personal team), and the request sets credential_on_stdin, then plan asks the cmux platform for the workspace machine itself (POST /v1/workspaces/{w}/machine, under the send's create_key). It pins that machine as it would one the App made, and answers it with ensured. The machine boots from the repository's set-up snapshot once that snapshot is ready.
  • The platform made no machine (404 that isn't a refused environment, 401/403, workspace_machine.unconfigured or not_admitted): the plan answers as before (machine: null), and the App makes the machine.
  • The platform may have made one (unreachable, a placement or conflict error), or the environment was refused: the send is refused with that code. A retry with the same key reaches the same machine, so the App never makes a second paid machine next to it.
  • The App (Swift, forwarding only, no net lines added): passes the chat's folder and, on the personal account, the cmux access token on stdin. When the plan answers a machine the App hasn't listed yet, it reads its list again so the attach finds that machine (it's a row of the account's CloudDO list).

The cloud environment the sheet picks (#30359, AgentPaneCloudStart.environment) is passed to planRequest(environment:) once that PR lands. The parameter is here already.

Testing

  • Rust: a new test, plan_makes_a_personal_repository_sends_machine_through_the_platform, uses a fake platform. It covers the ensured machine being pinned, a retry staying on it without a second call, a team send and a send without the flag never calling the platform, the fallbacks (404, no credential), and the refusals (cloud_environment.not_found, unreachable).
  • Swift: thePlanRequestCarriesTheSendItsAccountWorkspaceAndTheListedMachines now also checks the local, environment and credential_on_stdin fields.
  • cmux-ci test -- cargo test --manifest-path cmux-tui/Cargo.toml -p cmux-tui start_chat, plus a Swift compile check (results in a comment).

Observed / Not run

  • Not run yet: an end-to-end send from a DEV build to a real Cloud machine.

Changelog

none

šŸ¤– Generated with Claude Code
Agent session: agent session