cmux NEXT Cloud: pick a chat's machine from its folder, sent as autosize (no machine or size prompt)

Merged
TE
7d ago
+596-17

What

A chat sent to cmux Cloud gets its machine chosen from the chat's folder, with no machine, size or environment prompt.

CloudWorkPick (CmuxNextCloud) reads, from the chat's working directory:

  • the repo key (host/owner/name, lower-cased) from the remote, never a login or password from the URL;
  • the GitHub repo a new machine can clone, at the current branch when it is pushed (an unpushed branch clones the default branch);
  • the checkout's git object size and its root file names (Package.swift, Cargo.toml, package.json, …), which give the server the toolchain;
  • the task kind. The rule is simple and documented on CloudTaskKind.inferred(from:): a whole word naming testing makes it test, else a word naming building makes it build, else chat. It reads the chat's title;
  • whether .cmux/machine.toml exists, and whether the agent is Codex (which needs the Codex broker).

Every git command is local, with no network, and bounded at 3 s. A command that fails just leaves its fact out. A folder outside git gets no repo, and its root files still go.

Where it's used:

  • Move to Cloud when there is no machine to reuse. The existing reuse order (the named machine, else a connected one, else any) is unchanged.
  • New Cloud Machine asked from a chat (the composer's row names its tab). The setup offers the chat's own repository as the starting point. The machine is sized for the chat only when the person keeps that repository.

Both send autosize: {taskKind, repo: {key, sizeMb, rootFiles}} with POST /api/vm (#26617, #26630). A memoryMb still wins.

The answer's sizePick {vcpus, memoryGb, pick, reason} is decoded on CloudMachine.sizePick. It is also kept on CloudMachineSession.sizePick, which a list read does not overwrite. That copy is what the hand-off reads: CloudSizePick.handoffSize is POST /v1/handoffs's size.

Why

Leo, 2026-10-28: "whatever's convenient for cloud, like that can be productionized, operationalized, we ought to just put out there"

Leo, 2026-10-28: "like as auto as chatgpt work and not NEEDING to deal with picking environments... the auto thing situation". And: "You know how we did that automatic routing, automatic sizing ... We want to have that for the cloud machines too ... Like ChatGPT work."

Risk

  • Everything here is behind Labs preview features, the design's rule for new work-mode surfaces. With Labs off, nothing is read and every create is byte-for-byte as before.
  • With Labs on, a moved chat's new machine takes the server's pick instead of the plan's default size. A plain chat may get a smaller machine than before; that is the server table's call (#26617).
  • Reading the pick runs up to five local git commands and one directory listing, only when a machine is about to be created.
  • No new strings and no UI change. The setup dialog's starting point is prefilled only for a chat in a GitHub repo, with Labs on.

Tests

CloudWorkPickTests covers:

  • a Swift package, Rust and Node repos with GitHub and non-GitHub remotes;
  • unpushed branches;
  • a non-git folder;
  • the task-kind rule;
  • that remote keys never carry credentials;
  • the upstream track parse;
  • sizePick decoding, where a malformed one drops the line and never the machine;
  • that the setup is sized only for the chat's own repository.

CloudWorkspaceSetupWizardTests covers the suggested starting point. These ran as package tests on the Mac fleet.

No capture: with Labs preview features off (the default), nothing changes on screen. With Labs on, nothing new is drawn either. The one visible difference is a field's starting value: when New Cloud Machine is opened from a chat's composer, its setup dialog starts on "From repository" with the chat's own repo filled in (CloudWorkspaceSetupWizardTests.aChatsRepositoryIsTheSuggestedStartingPoint). No capture scene opens that dialog from a chat. The size line in the chat is the follow-up UI PR, which comes with before/after captures.

Agent session: agent session

šŸ¤– Generated with Claude Code