fix(cloud): replay placement only for new daemon tabs and display views

Merged
AU
17d ago
+21-5

A recorded or restored Cloud daemon tab no longer queues a remote move. #15748 moved the placement sync from materialization into SurfaceCatalog.record(_:), so every recorded daemon tab started queueing one. That includes tabs from session restore, replaced projections and reservations, and even tabs the remote graph no longer has. CloudPlacementCoordinatorTests.aMissingTrackedTabClearsCoordinatesEvenWhenOtherViewsRemain has failed deterministically since then, and it is one of the #15488 failures.

This narrows which record paths #15748 replays placement for. Three things point to the replay of daemon tabs on record being unintended:

  • #15748 left CloudPlacementCoordinatorTests unchanged, and that test asserts the earlier behavior.
  • Replaying on record moves remote tabs during session restore, which #15748's description doesn't mention.
  • record(_:) is documented to reconcile a pane with the installed graph, not to move it.

Display memberships, which #15748 added this path for, still replay when recorded.

Cause

record(_:) now calls recordCloudProjection, which calls cloudPlacementCoordinator.projectionDidMove for every projection. The test records a terminal projection at ws_main/tab_gone in a workspace bound to ws_api, so projectionDidMove queues a placement lane. reconcileRemoteState then stops at guard lanes[state.machine] == nil, and the missing tab keeps its coordinates:

CloudPlacementCoordinatorTests.swift:635  (catalog.projection(forPanel: panel)?.remoteTabID → "tab_gone") == nil
CloudPlacementCoordinatorTests.swift:636  (… remoteWorkspaceID → "ws_main") == nil

It failed in shard 6 of validation run 36713362165, on a Blacksmith runner. It passed in main's full suite at 478e3232b, before #15748. The test is synchronous and #15748 didn't change it.

Change

  • recordCloudProjection still admits a local display view through the placement coordinator, which is what #15748 added it for. It no longer replays a daemon tab.
  • A daemon tab this catalog materializes syncs its placement once, as it did before #15748. This happens on the direct path and when an in-flight materialization completes and owns its pane.
  • Session restore and cleanupMaterialization record daemon tabs without a replay, as they did before #15748.

SurfaceCatalog.swift stays at its line budget; the two helpers live in SurfaceCatalog+CloudDisplayProjection.swift.

Verification

  • Changed-suites lane, on top of #16025: this PR's run passed CloudPlacementCoordinatorTests, CloudMachineWorkspaceAdoptionTests, the native layout projection, port discovery and recovery, sidebar surface lifecycle, surface ownership, terminal pane reservation and placement, live workspace projection and workspace membership suites.
  • Full-suite validation: the #15488 validation runs, which include this change, passed aMissingTrackedTabClearsCoordinatesEvenWhenOtherViewsRemain.
  • Nothing was compiled on the authoring Mac.

Changelog

  • Fixed: restoring a session with Cloud terminal tabs no longer tries to move those tabs on the Cloud machine.

🤖 Generated with Claude Code