perf: stabilize Cloud startup and desktop readiness
Problem
Cloud dogfood still showed a first-use flicker and high main-thread churn when a tagged dev backend exposed a large fleet. A new Cloud terminal could briefly materialize through the wrong pane, while noVNC showed a blank document during desktop readiness. Background discovery also refreshed every known provider, which made the app temporarily unresponsive with many machines.
Issue: https://github.com/manaflow-ai/cmux/issues/13070
Changes
- Carry an immutable Cloud loading-pane reservation through materialization and reject late attachment into another pane. The pending pane remains recoverable instead of flashing a local terminal or leaving a stale attachment.
- Start the account-level user-space carrier as soon as the Cloud beta gate enables background Cloud work.
- Avoid a redundant VM status request before
cmux_remote_infoand avoid a blocking full graph refresh after a workspace creation receipt. - Limit background provider refreshes to machines with local projections; explicit refreshes still reconcile the full fleet.
- Keep noVNC behind its connection card until the desktop proxy is ready, and log proxy/heal/ready timings in DEBUG builds.
- Track Cloud workspace creation phases (
remote_workspace,remote_terminal,projection,complete) in the tagged debug log. - Remove the nonfunctional Cancel button from the create loading surface and show elapsed time plus the existing localized background guidance.
Evidence
- Cold private dev backend: first create was 22.7s; the backend's first dynamic
GET /api/vm/<id>and attach routes compiled for 6.2s and 5.9s. Warm creates were 6.8–6.9s. - Provider create itself was 1.8–2.6s; the user-space WireGuard/TUI link was ~0.2s once the endpoint was ready.
- A fresh VM cannot reach 200ms without a provider warm pool or a pre-created/billed VM; this patch prewarms the reusable carrier and removes avoidable app/backend round trips.
Validation
python3 scripts/swift_file_length_budget.py./scripts/lint-pbxproj-test-wiring.shpython3 scripts/localization_catalog.py checkgit diff --check- Hosted tagged build:
issue-13070-cloud-startup-permission - Current-head controller receipt and archive verification recorded under
out/13152-cloud-startup/
Build limitation: the current controller recipe embeds its default :3800 backend; the isolated tag backend is healthy at :3894. The published artifact is launched with the isolated backend in its process environment for dogfood.
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.
Summary by cubic
Fixes #13070. Cloud startup and desktop readiness now recover cleanly instead of attaching to the wrong pane, creating a local terminal, showing a blank desktop page, or refreshing unnecessary data. The optimistic opening card stays hidden until the terminal is ready, so it never flashes in the wrong pane. Failed or cancelled opens restore a retryable loading card without disturbing existing content.
- Loading panes keep their stable identity and destination; concurrent opens share one attachment per workspace, while later workspaces remain separate.
- Cloud projections preserve global ownership during polling, and background refreshes target only active or unrefreshed machines, including sleeping providers.
- Startup skips redundant VM and graph requests, prewarms the reusable Cloud link, and lowers the
cmux_remote_infotimeout to 30 seconds. - Desktop access stays behind its connection card until the proxy is ready, with DEBUG timing logs for creation and proxy phases.
- Creation cards show elapsed time and background guidance without Cancel; notification delivery retries without refolding unchanged snapshots.
- Cloud list and attach requests now use fixed timeouts and a single-attempt budget; attach no longer retries on transient service unavailability.
- Cloud tree rows reserve a real icon slot with a consistent disclosure gap and restored compact spacing, so machine icons no longer clip or misalign.
- Adds coverage for adoption, cancellation, placement recovery, workspace resolution, polling, refresh behavior, list/attach request budgets, and notification retries.
Summary by CodeRabbit
-
New Features
- Cloud machine creation cards now show live progress, status, machine name, and elapsed time.
- Cloud machine loading cards can transition smoothly into connected terminals and return to a retryable state when placement fails.
- Desktop browser access now displays a connection card while the page is preparing.
-
Bug Fixes
- Improved handling of concurrent openings, reconnections, workspace changes, and cancelled destinations.
- Cloud notifications that temporarily fail delivery now retry without reprocessing unchanged updates.
- Improved terminal and workspace resolution during cloud machine access.