Fix Cloud display ownership and connection readiness
Cloud display views now retain stable owning VM identity through creation, duplication, browser and Dock persistence, delayed restoration, moves, and session restore. The shared SurfaceOwnershipPolicy rejects foreign, unknown, and stale provenance before placement or transport mutation, with a final ownership check after async work. Existing same-VM multiple views remain supported.
Addresses https://github.com/manaflow-ai/cmux/issues/13192.
The screenshot does not establish a duration or transport failure. This change traces route readiness, navigation start/commit/finish/cancel, noVNC connection state, reconnect, and a bounded retryable deadline. Progress and errors are display-specific; no URLs or credentials are logged.
A scoped New Display action now discovers and creates independent guest display resources. Each resource has a stable VM/display identity, separate X/RFB/noVNC ports and session state, a persisted request receipt, and its own route. Discovery and creation are capability-gated through the existing VM-authorized exec path; unchanged images remain truthfully unavailable until the runtime is present. The existing Desktop resource and prior views are preserved.
The guest supervisor now isolates and recovers per-display desktop components, noVNC transport, and process ownership across helper restarts. URL-only navigation cannot invent undiscovered display slots, and restored display queries cannot override the authenticated host or port.
Validation on the merged branch (latest origin/main merged and pushed):
- 14 Python catalog/supervision tests covering independent endpoints, same-label VM isolation, receipts/retries, capacity, stale/failed discovery, component recovery, and scoped process adoption.
- 14 focused Bun baked-image contract tests pass.
- Swift frontend parsing, PBX normalization and test wiring, localization parity for all nine required macOS locales, Swift file-length budget, and whitespace checks pass. No budget TSV was changed.
- Native regressions cover cross-VM rejection, unknown provenance, same-VM duplicate views, Dock/pane/tab/restore paths, changed async destinations, provider retirement, readiness, cancellation, timeout, retry, display identity, and service-port changes.
- Final
$autoreviewis clean with no actionable findings. PR #13196 is open and mergeable; no merge or issue close was performed.
Fleet build and launch:
- SHA:
e2fb4e3465efac18b4f670d1693205f9edc99f4f - Tag:
issue-13192-cloud-display-ownership - Job:
fb18a0d65f1eb6747f49b053 - Worker:
cmux7s-Mac-mini.local - Terminal receipt:
artifacts/fleet/e2fb4e3465efac18b4f670d1693205f9edc99f4f-terminal.json - Artifact SHA-256:
40e22393a8e442c3145f3321ae86916825e589f9e09810aa87901d836ca7851e - HQ tagged build
The verified app is running from the tagged bundle cmux DEV issue-13192-cloud-display-ownership. A supported isolated Cloud GUI recipe was unavailable, so no two-VM visual rejection video, original first-open timing capture, or two-real-guest-screen rendering proof is claimed. No production image, live user VM, billing state, or deployment was changed.
Latest main merge and review-comment closeout
Merged the current origin/main at 931792787f and pushed the resolved branch at 812b4ef07d.
The remaining non-outdated review threads were verified against the current code, replied to, and resolved. The closeout includes global Dock ownership/pending restores, Cloud service-port rebinding, external/cancelled navigation ownership, hidden restore activation, display-slot discovery, guest supervisor recovery/readiness, bounded discovery retries, duplicate URL preservation, sanitized New Display errors, and display-port filtering.
Latest validation passes:
- 14 focused Python guest catalog/supervisor tests.
- 14 focused Bun desktop contract tests.
- Swift parsing, PBX normalization, test wiring, localization parity, Swift file budgets, and
git diff --check.
The PR remains open and unmerged. GUI Cloud runtime proof remains unavailable because the controller has no supported isolated GUI recipe.
Latest merge/conflict and comment closeout
Merged the current origin/main at c29c4da25c and resolved the Cloud browser/route, SurfaceCatalog materialization, and Cloud display UI conflicts. The pushed head is 42f1ab4a076daefbb396ae3501fd66fa34688ab4 and GitHub reports the PR mergeable.
All currently non-outdated review threads are resolved. The latest fixes include global Dock pending restore policy, display-port preservation filtering, route/duplicate URL preservation, bounded guest startup/discovery readiness, hidden restore activation, sanitized display errors, and final ownership validation after materialization.
Final focused validation after the merge: 14 guest catalog/supervisor tests, 14 desktop contract tests, Swift parsing, PBX normalization, test wiring, localization parity, Swift file-length budget, and diff checks pass. No merge or issue close was performed.
Latest CI repair: after current origin/main advanced, the merged base exposed duplicate SurfaceCatalog declarations and a provider display-coordinator initialization conflict. Those were resolved in the pushed head 23c807b50ab406e508de46c07b5e22f7df7c1ad9; the PR is currently mergeable and CI is rerunning. The latest focused guards pass locally.
CI status for current head 23c807b50ab406e508de46c07b5e22f7df7c1ad9: static/workflow/Linux checks are green; macOS compile admission is still running in CI run 35560913107. All current non-outdated review threads are resolved.
Merge of origin/main at dcdeab336e
Merged the current origin/main (dcdeab336e) into the branch. The first merge (11396c3382, pushed as 210df4c84d) had conflicts in Sources/Cloud/CloudTreeRowContentView.swift, Sources/Surfaces/SurfaceCatalog.swift, Sources/Workspace.swift, and cmux.xcodeproj/project.pbxproj. Because main moved CloudTreeRowHoverButtons into its own file, that resolution silently dropped this PR's displays-pool New Display hover button; e18669f557 restores it in Sources/Cloud/CloudTreeRowHoverButtons.swift together with its hasButtons entry. The follow-up merge of the newer main (7856fa7fa0) applied cleanly, and 1eda271279 keeps SurfaceCatalog.swift within its Swift file-length budget.
Checks on the pushed head 1eda271279: check-pbxproj.sh, lint-pbxproj-test-wiring.sh, normalize-pbxproj.py --check, localization_catalog.py check (9 locales, 0 parity errors), swift_file_length_budget.py, check-package-resolved-policy.py, check-workspace-package-groups.py, git diff --check, and swiftc -frontend -parse on every Swift file the merge touched all pass. origin/main is an ancestor of the branch. The fleet controller was unreachable from the submitting network at merge time, so the fleet build of this head is still pending; hosted CI is the current compile evidence.
Merge of origin/main at 0ddc6f406c
Merged the current origin/main (0ddc6f406c, 89 commits including the relay core RPC v2 and production-app-hang work) into the branch as 2bc5ca3aa8. One conflict, in Sources/Workspace.swift: this PR's acceptsRestoredSession ownership guard at the top of restoreSessionSnapshot collided with main's new beginTerminalGeometryTransition(.restore) bracket. Resolved by keeping both, with the ownership guard first so a rejected snapshot never opens a geometry transition. The Cloud tree row, localization catalog, and project file auto-merged with the earlier New Display hover-button restoration intact.
Checks on 2bc5ca3aa8: check-pbxproj.sh, normalize-pbxproj.py --check, lint-pbxproj-test-wiring.sh, localization_catalog.py check, swift_file_length_budget.py, check-package-resolved-policy.py, check-workspace-package-groups.py, git diff --check, and swiftc -frontend -parse on all 94 app Swift files the merge touched pass. origin/main is an ancestor of the branch.
Merge of origin/main at 4be6fb7865
Merged the current origin/main (4be6fb7865, 185 commits) into the branch as 21a652e8ba. No conflicts. Checks on the pushed head: check-pbxproj.sh, normalize-pbxproj.py --check, lint-pbxproj-test-wiring.sh, localization_catalog.py check, swift_file_length_budget.py, check-package-resolved-policy.py, check-workspace-package-groups.py, and swiftc -frontend -parse on the 34 app Swift files the merge touched all pass. origin/main is an ancestor of the branch.