cmux NEXT Cloud: the agent's chat links to the Cloud session it started

Merged
AU
11d ago
+293-10

Fixes #25597

What changes

cmux cloud start-session (https://github.com/manaflow-ai/cmux/pull/25319, https://github.com/manaflow-ai/cmux/pull/25414) already lets an ACP agent in a chat ask to start a session on a new or existing Cloud machine. The person clicks Start on the card in the agent's chat. The machine is created or resumed, it appears in the sidebar under its own machine section, and a chat on that machine starts the agent. What was missing was the third part of the acceptance, the chat links to it. On success the card just disappeared, and nothing in the asking chat pointed to where the work went.

Now, once the session runs, the card in the asking chat turns into a done card:

claude runs on Cloud machine dev. Its chat is in that machine's workspace in the sidebar. [Open Chat] [Dismiss]

  • Open Chat shows the new chat on the machine through AppServices.revealTab, the same way Go To and cmux:// links jump to a tab. Nothing is shown until the person clicks, so the agent's run never moves focus (revealing: false is unchanged).
  • If no connected machine lists the new chat any more (its tab was closed, or the machine is disconnected), Open Chat says so in a failed card with Dismiss.
  • The done card belongs to the ask that started the run. A later ask in the same chat takes the card over, and the old card's buttons then do nothing. A sign-out or team switch (endAll) removes done cards, because their Open Chat would show a chat from the account that ended.
  • Tool cards have a new done state in AgentPaneToolCard.State and in the page store (toolCardStore.ts). The page draws it like the other states, with the host's text and buttons. A gallery variant agent-pane.tool-cards/started shows it.
  • Three new strings in CloudSessions.xcstrings (openChat, started, chatGone), in all 21 languages: en and ja are translated, the others needs_review, as the table's existing keys are.
  • What's New highlight: release-notes/next/highlights/cloud-start-session-chat-link.md.

Defaults I picked

  • The link is a button on the existing tool card, not a new message in the transcript. The card is the place the person already answered, and it needs no acpmux or transcript schema change.
  • The done card stays until Open Chat, Dismiss, a new ask in that chat, or a sign-out. It is not persisted across relaunch. After a relaunch, the new chat is still in the machine's workspace in the sidebar.

Changelog

  • Added: After you start a Cloud session from an agent's chat, the chat's card links to the new chat on the Cloud machine (Open Chat).

Tests

  • CloudStartSessionAsksTests: a started run leaves a done card with Open Chat and Dismiss, and nothing is revealed before the click. Open Chat on a closed chat says it is gone. The link belongs to its ask, and a later ask takes the card. endAll removes a done card. The page receives the state as done.
  • webviews/.../toolCardStore.test.ts: the store keeps a done card and drops an unknown state.
  • Red/green: the tests commit (0a542c2ecdd2) fails on the fleet because started(…) and .done don't exist yet. The head passes; results are below.

Observed / Not run

  • Ran: python3 scripts/cmux-next/prepush-gate.py (no new violations; an advisory app-size warning for +30 App lines in Cloud/, which is where this verb's code already lives). scripts/web-lint.sh (webviews bun run check) passed.
  • Fleet: on the head a771afbd6ea8, CloudStartSessionAsksTests and CloudStartSessionTests passed (cmux-ci run --class light --script scripts/ci/package-test-lane.sh --arg=suite --arg=Packages/macOS/CmuxNext --arg=CloudStartSessionAsksTests,CloudStartSessionTests, step 2de45cd511265ac4e0a34689 on aws-m4pro-7). Red on the tests-only commit 0a542c2ecdd2: fails as expected (step 3193b0739e5b27d32cc04e47 on aws-m4pro-7): value of type 'CloudStartSessionAsks' has no member 'started' and CloudStartSessionStrings has no started/chatGone.
  • Not run: an end-to-end Start against a real Cloud machine. That needs a signed-in Cloud account and creates a billed VM, so this is left for dogfood on the tagged build below.

Capture: No capture: the card is the existing agent tool card (AgentPaneToolCard) with a new done state. Its webview rendering is the gallery variant agent-pane.tool-cards/started, and the change has no native UI. Dev build: tag 25597-chat-links-cloud-session (fleet job d34ae5a9cca53fdedfb63c57).

Review: Review (claude review subagent): SHIP at a771afbd6ea8d11c7f031d59dcda669f8c9f1223. Findings and their fixes are in the PR comments.

šŸ¤– Generated with Claude Code