Repository navigation
cmux NEXT Cloud: cmux cloud start-session, start an agent on a machine (2/2) - #25319
Conversation
|
Owned by an agent session · session |
|
cmux status (one comment, edited in place; each line is updated by the job that owns it) Review App of this head (app.zip, kept 1 day)
Seen on other PRs too (likely flaky): CI failed on
Failures:
A web test can import code this PR changes without being one of its files: Matched log linesNot re-run automatically: Written by red: web / Web status; NEW: green on the base d1c305f; do not merge until green; see lane-rules
Agents: |
This comment has been minimized.
This comment has been minimized.
|
Bead |
…gent's chat `cmux cloud start-session --target machine:<id> | --name <name> --agent <harness> [--cwd <folder>]` takes the machine (or creates the named one), connects, opens a chat tab on its store and starts the session in that machine's acpmux through agent-session-start (the keyed start a page's first send uses). It answers machine_id, session_id and host. An agent's run asks the person with a card in its own chat first (Start, Not now), like an agent's Move to Cloud. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?id=aid-4ba8980ae4e8eecb82d6
…e a card that can't show Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?id=aid-4ba8980ae4e8eecb82d6
…ending run's end is handed to the same command; name create failures Review fixes: - The ask owns its chat's card, by token, until its run ends; a second ask is refused. - Runs are joined by what they ask for. A run that outlasted its caller's answer is kept (at most 10 min and 32 runs, pruned when a run starts, no timer) for the same command's next run. - A machine that can't be created says so, with the command. - The --cwd hint gives the full command. - The action carries a description, as #25254 added. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?id=aid-4ba8980ae4e8eecb82d6
7867074 to
8fae4c3
Compare
…ng; quote the retry name; a capture scene of the ask card Review fixes: - CloudStartSessionRuns runs each caller's answer race itself. A run that ends with a caller waiting is dropped. One that every caller left is kept for the next same ask, handed out once, and expires for that same key too. - Tests use explicit signals (an injected wait, a card-shown stream) instead of yield counts. - The create-failure retry command quotes the machine name as one shell word. - DEBUG scene cloud-start-session-ask: the real ask card in the showcase chat. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?id=aid-4ba8980ae4e8eecb82d6
Bugbot needs on-demand usage enabledBugbot uses usage-based billing for this team and requires on-demand usage to be enabled. A team admin can enable on-demand usage in the Cursor dashboard. |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?id=aid-4ba8980ae4e8eecb82d6
This comment has been minimized.
This comment has been minimized.
|
|
…achine's chat may ask; the keep limit holds when runs end together Review fixes: - The production pending answer carries pending: true (with a test through the race). - Agents in a chat on any machine's store are found. - Kept runs are trimmed when a run is kept, not only when one starts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?id=aid-4ba8980ae4e8eecb82d6
… reads a fresh machine list and creates once per name; refusals repeat the full command Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?id=aid-4ba8980ae4e8eecb82d6
|
|
…t without stringValue Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?id=aid-4ba8980ae4e8eecb82d6
…/ergo-cloud-start-session
Base's exports predate its auto-archive actions; these are the export script's output for this tree. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?id=aid-4ba8980ae4e8eecb82d6
|
|
Bugbot needs on-demand usage enabledBugbot uses usage-based billing for this team and requires on-demand usage to be enabled. A team admin can enable on-demand usage in the Cursor dashboard. |
… wakeup lint Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?id=aid-4ba8980ae4e8eecb82d6
…osed Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?id=aid-4ba8980ae4e8eecb82d6
…sion-asks' into p0-machines/ergo-cloud-start-session
…/ergo-cloud-start-session # Conflicts: # Packages/macOS/CmuxNext/Sources/CmuxNextApp/Cloud/CloudService.swift # Packages/macOS/CmuxNext/Sources/CmuxNextApp/Cloud/CloudStartSessionStrings.swift # Packages/macOS/CmuxNext/Sources/CmuxNextApp/Resources/CloudSessions.xcstrings
Bugbot needs on-demand usage enabledBugbot uses usage-based billing for this team and requires on-demand usage to be enabled. A team admin can enable on-demand usage in the Cursor dashboard. |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?id=aid-4ba8980ae4e8eecb82d6
…ument Agent in de and fr Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?id=aid-4ba8980ae4e8eecb82d6
…lish, instead of an allowlist entry Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?id=aid-4ba8980ae4e8eecb82d6
…/ergo-cloud-start-session # Conflicts: # Packages/macOS/CmuxNext/Sources/CmuxNextApp/Cloud/CloudService.swift
|
Shipped in:
|
Audit group §2d (p0-machines): start a VM from an ACP chat. This is part 2 of 2. Part 1, #25414 (landed), holds the agent ask card and the runs registry (
CloudStartSessionAsks.swift) with their tests and strings.Lawrence: "start new VMs from acp chat", with "decouple persistence of acp trajectories from the VM itself, in case the VM is resuming".
Leo: "so chieff related stuff we dont need to worry too much about but ergo of commands and docs and error/hint messages we do need ... anyways those are just quite a few things that we already kinda own/should prob own"
What changes
One explicit call:
It answers
{machine_id, session_id, host}, plusmachine_name,target,agent, and the chat'sworkspace_id,surface_idandtab_id.--target, else the one named--name, else it creates that machine) and connects. A paused machine resumes.registry:<id>) in the machine's first workspace.agent-session-start, the same keyed start a new remote chat's first send uses (AgentTabRemoteHost.startNowreuseskeyedStart).The person sees the chat in the machine's workspace.
Running it again. A run that answers
pending(a new machine can take minutes) keeps going. The same command again joins it, or picks up its end once. A run whose caller already got its answer is not kept, so the next run starts a new session.An agent's run asks first. A run from the cmux MCP server (or nested inside one: the outer run's origin decides), or from a shell naming its chat, puts a card in the agent's own chat: "The agent asks to start a claude session on Cloud machine dev", with Start and Not now. It follows
cloud move's agent ask (CloudMoveAsks). Only Start creates or starts anything, and then as the person's run. Nobody answering within 2 minutes is a refusal that says so. The chat may be local or on a Cloud machine (an agent started by this verb can start another).--namenever makes a second machine. It needs a list the server answered within 15 s for the user and team signed in now (CloudService.hasCurrentList(within:)), and reads one if not. A failed or superseded read, or another team's list, refuses: a machine of that name may exist, checkcmux cloud list-machines, then run the same command again. Two runs naming the same new machine share one create.Per account. A run carries the user and team signed in when it was asked, and checks it (and cancellation) before every step that changes anything and after every wait: the list read, the create (before the new machine joins this Mac's list or connects:
CloudService.createMachine'sproceed), the resume or connect, the first-workspace fallback (CloudHandlers.terminalAnchor'sproceed, right before it creates one), the tab, and each keyed restart and start try (AgentTabRemoteHost.startNow'sproceed). After the start the session exists, so the result reports it, but nothing is shown on screen if the account changed meanwhile. A--targetmust be in the machine list read for the account signed in now (hasLoadedCurrentMachines): after a team switch, the previous team's machines stay in the store until that list lands, and a target among them refuses, saying to checkcmux cloud list-machines. A team switch or sign-out while a card is open or a start is going on stops the run with a refusal that says so and gives the command. Runs and creations are also keyed by that account, so another account's ask never joins or takes them, and a sign-out or user change (CloudService.dropAllMachines) cancels and forgets them.Why a new verb, not
cloud move --new-sessioncloud movemoves an existing local chat: it syncs its folder and moves its session and history. Its target is a tab.--new-sessionflag would make one verb take two target kinds, with half its flags (--path, update/retry) meaningless in one mode.web/app/api/vm/[id]/acpmux/keyed-startdoesn't start a session. It only restarts the machine's acpmux with the person's key (for approvals), and the app already calls it throughrestartWithApprovalswhen a start needs that.So the verb starts the session the way the app already does, through
agent-session-starton the machine's daemon, and keyed-start is reached only through that approvals path.Persistence (hq#4381)
cloud movedoes.cmux-tui/crates/acpmux/srcon current base has nopeer_snapshotor similar hook. I greppedpeer_snapshot,client_snapshotandPeerSnapshot.CloudStartSession.runright afterstartNowanswers. The session id is known there, and a comment marks the spot. I did not make up a hook name.Errors
Every failure names the machine and the agent and gives a CLI command, for example:
devstarted but its agent didn't (The agent service on dev did not start). Runcmux cloud start-session --target machine:vm-x --agent claudeagain."--cwd.cmux cloud machine-status.cmux cloud start-session --name 'my dev' --agent claude).Strings are in new tables (
CloudSessionActions.xcstrings,CloudSessions.xcstrings) in all 21 languages the l10n gate requires. They don't touchCloud.xcstrings.Capture
No capture: the capture build of this head (fleet job aa9ed4b4719fad6af2a2921b, and the earlier 336a287df6bad0203956cb94) fails before the app builds, because the fleet's Linux pool has bun 1.4.2 and webviews needs 1.4.4 or newer. The card is the existing agent tool card (
AgentPaneToolCard, ascloud moveshows it) with this verb's text; the DEBUG scenecloud-start-session-ask(cmux-ci capture <sha> --state scene:cloud-start-session-ask) shows it once the pool is updated.Timers and loops
The card's deadline and account watch, the caller deadline, the runs registry and
CloudService's account observer are in #25414. This PR adds:CloudMove.holds, an observation raced with one sleep; the group is cancelled when either side wins). A tab not listed in time refuses.CloudMove.holds.pending: true10 s beforeaction.run's 200 s person deadline (CloudStartSessionRuns.answer), with text giving the same command to run again. The work keeps going until the start succeeds or fails, or the account ends.Size
1624 added lines over the ~800 cap:
CloudStartSession.swift), its strings, the catalog entry, the account guards inAgentTabRemoteHost,CloudServiceandCloudHandlers, and one-line registrations.This is already the second half of a split (the coordinator asked for it after nine rounds); the start path, its strings and its tests can't land apart without leaving a verb with no strings or no tests.
Tests
CloudStartSessionTests(the card and the runs registry are tested in #25414):--agentand a bad--cwdrefused--namewith no machine list read (no sign-in) refuses, creates nothing, and gives the commands to check and rerun--targetoutside the list of the account signed in now starts nothing and says sopending: trueAgent session: Air-Blue
🤖 Generated with Claude Code