Cloud sidebar: Terminals lists every resource (detached greyed), a workspace folder is its layout, Ports before VNC Displays

Merged
AU
2mo ago
+1153-205

Follow-up to #11773 (merged as 768d81179e); rebased onto main.

The layout

Under a connected cloud machine the right sidebar now shows exactly four groups, in this order (Workspaces, Ports and the desktop are the order cmux vm tree prints; the Terminals section is the sidebar's flat index, last):

GroupWhat it listsPresent
Workspacesone row per cmux-tui workspace; a folder is exactly its layout — the terminals with a tab in it, its browsers, its screenalways (+ = New Workspace; "No workspaces yet" when empty)
Portslistening ports as linkswhen any
VNC Displaysone row per screen (display:1, …), detail noVNC · :1when the machine has a desktop
Terminals (last, its own section)every terminal resource the machine owns, one row per identity, badge = daemon tabs; a terminal no tab shows (still running, in no layout) is greyed and marked "detached" — click re-attaches it in a pane, right-click › Kill Terminal… ends italways (+ = New Terminal; "No terminals yet" when empty)

The two rules that make it hang together:

  1. The machine's Terminals section is the list of all terminal resources, at the bottom as its own section. Not only the ones in no workspace (that orphan-only pool came from #11626; the Blaxel-era pool listed every terminal). Detached ones are in it too, greyed.
  2. A workspace folder is its layout. When a terminal's tab in the workspace closes (or the workspace is closed with vm workspace close, which keeps its terminals running), the terminal leaves the folder — nothing lingers under the workspace. It stays reachable in Terminals, greyed, where a click re-attaches it and Kill Terminal… kills it. The workspace's count, its open/drag group, and vm workspace open all describe the layout only.

Also: the group is labeled VNC Displays and each row names its screen; the cloud-machine Browsers group is gone (a daemon browser is under its workspace or under Ports — one with neither had no row anyone reached; This Mac's gated-off Browsers group is untouched). cmux vm tree prints the desktop after ports; its (detached — …) group is unchanged.

Parity

Every verb is intact; the parity table gains the Terminals › detached row (cmux surface open <m>/terminal/<term> / cmux vm terminal close <m> <term>). No socket change. The detached state is what the daemon already reports (remote_views: []).

Tests

  • Red commit: CloudTreeOneMachineManyWorkspacesTests pins the four groups, every-terminal Terminals, and the always-present groups; MachinesPanelModelTests.testCloudTreeWorkspacesLeadThenPools updated to the same shape. Fails on the base branch. (The third commit moves Terminals to the bottom and re-pins the order.)
  • Green commit: the layout-only folder rule (a zero-view terminal has no workspace row, is greyed in Terminals, keeps its kill verb and drag, and is out of the count / drag group / lookupRemoteWorkspace) and per-screen displays (CloudTreeDisplayDetail).
  • Strict lane (test-e2e.yml, non-tolerant) on this branch: CloudTreeOneMachineManyWorkspacesTests, MachinesPanelModelTests, MachineCreateCoordinatorTests.
  • The last commit fixes three lines in cmuxTests/MachineCreateCoordinatorTests.swift (from #11773's tunnel-correlation tests) that did not compile: an #expect on an optional Bool and two Self.newMachineRequest calls in MachinesPanelPendingCreateTests. Until then every strict-lane run on the cmuxTests target failed before running a test — the first two dispatches on this branch failed that way.

Localization audit

Surfaces changed: the Displays group label, the display row detail, the detached terminal mark and its tooltip, the empty-Terminals placeholder. cloudTree.group.displays relabeled "VNC Displays" (en + ja); new keys cloudTree.placeholder.noTerminals, cloudTree.terminal.detached, cloudTree.terminal.detached.help, cloudTree.node.desktop.detail.screen (en + ja). No bare English in the touched Swift; docs (sidebar-parity.md, commands.md, cloud-cmux-tui-daemon.md) updated.

Live verification

(filled in after dogfood on the tagged build)

🤖 Generated with Claude Code

https://claude.ai/code/session_013E7Ukqyku82Z8usRPExUHK

Summary by CodeRabbit

  • New Features

    • Cloud machines now organize Workspaces, Ports, VNC Displays, and Terminals consistently.
    • VNC displays appear as individual screen rows with screen details.
    • All machine terminals are listed, including detached terminals that can be reopened or terminated.
    • cmux vm tree and related CLI output reflect the updated resource structure.
  • Bug Fixes

    • Opening or connecting detects provider-side suspension and resumes machines when needed.
    • Newly created machines remain available until explicitly paused, stopped, or destroyed.
  • Documentation

    • Updated CLI, cloud machine, sidebar, resource documentation, and localization.

Wake and persistence

Freestyle Cloud machines are persistent boxes. New creates and restores send idleTimeoutSeconds: -1, so an idle provider default cannot silently suspend them. For machines created before that policy, the first explicit wake clears any finite legacy idle timeout best-effort.

Every user-open path (cmux-tui attach, shell attach, desktop/port open, and fork) now probes the live provider even when the Postgres row still says running. If Freestyle reports paused or stopped, cmux resumes it, waits for a settled running state, records the authoritative transition, and only then mints the endpoint. A failed live probe fails closed with a retryable error instead of leaving the sidebar on a stuck “Starting a terminal” state.

Validation: focused VM workflow/provider tests, the DB-backed vm-workflows suite, TypeScript typecheck, and the tagged macOS build passed. Tagged build: http://127.0.0.1:17320/cloud-tree-review