cmux NEXT: keep the first Cmd-N workspace in its slot
The first Cmd-N after launch can briefly draw a new workspace at the bottom before moving it after the selected workspace. This change refreshes the sidebar document projection in the same turn that accepts the placement, so the list can draw the requested slot immediately.
Addresses https://github.com/manaflow-ai/cmux/issues/25650. The stacked follow-up https://github.com/manaflow-ai/cmux/pull/27014 covers the stale-anchor first-painted-frame case; this PR does not close that acceptance on its own. Related placement work: https://github.com/manaflow-ai/cmux/pull/21914 and https://github.com/manaflow-ai/cmux/pull/23071.
Current revision
Current head: 23cd8d2141b705ad98079d0f4943501d17e0a478, rebased onto 6fbb57eb3ff3da62aa1f2443db0213782c1e2c88. The only base-integration conflict was the sidebar audit table; both entries were retained. The existing capture and fixture fixes are preserved.
An independent review of the first rebased head found a remote-close race: an immediate presentation refresh could erase the prior placement used to recognize a connected remote workspace closing, leaving its document item and an empty ancestor group. The current revision keeps that prior projection under regular show ownership alongside its live and connected sets. A deterministic regression covers the close/refresh/show interleaving and the disconnect case without a false close.
Static pre-push checks pass. Fresh independent whole-diff review: SHIP at this exact head; primary review agrees. Fleet job 4b58b7b967eebeaf6756417e completed with exit 0: ColdCmdNRowSlotTests (1 test), RapidWorkspaceCreateTests (5 tests), and SidebarDocReshowCloseTests (1 test with 2 cases) all passed. Test-summary SHA-256: 12e5867f0abdc7eed96cfa0cd5ef2d39ae7274eb95fbed0e322017a369d304a9. Hosted fast gates and the fleet Release compile also passed.
The only hosted static failure is No new SwiftUI in HomeChatColorsPanel.swift and HomeChatColorsView.swift: head run. The diagnostics exactly match base comparison run, whose archived command source is base 6fbb57eb3ff3da62aa1f2443db0213782c1e2c88; the checker, allowlist and both source blobs are identical. Every other static check passed. The separate review-link check failed when the CI app hit GitHub installation rate limits while patching a comment; no product/test failure is involved. The superseded-head native job was cancelled after the replacement head was confirmed. All earlier runtime and media evidence below remains historical at its stated head.
Observed / Not run
Historical verification at the pre-rebase head: a6f4815bf69486b91ebb866536e5f1610d013125.
-
Fleet job
cd1a4eb657905a10282fd75cpassedColdCmdNRowSlotTestsat this head. The combined job later hit observer-teardown/SIGSEGV failures and its time limit. -
Rechecked
RapidWorkspaceCreateTests(5 tests) andSidebarDoc(52 tests in 19 suites) on the same worker,aws-m4pro-1: head job88d9550c9cc4ea767a075086passed; based512fd7827427723178ab5c5366d720866faef54job0cd8fc0b8b3822f2b4e60ebaalso passed. -
Exact-head tagged DEV build passed and was published: job
635fd926cd50df6b211f6dce, tag25650-first-workspace-placement, explicit local backend for desktop-only verification. Artifact SHA-256:f731c17563c070634ff4e364d330a338b136e9d5844f999be96e0f31d300e138. The separate daemon-tree publication failed (run); no cloud-runtime verification is claimed. -
The cold-launch test seeds existing workspaces before the app connects, selects a middle row, and observes list applications through daemon confirmation. It also passes on the earlier test-only baseline, so it does not establish red/green reproduction of the first-painted-frame bug.
-
The capture script requires a visible new row, three equal settled samples, and the correct final position; the earlier false-success review finding is addressed.
-
No local Swift or Xcode build/test ran on the agent Mac.
-
Exact-head real-app DEV cold-relaunch verification passed on
cmux11s-mac-mini, reusing build job635fd926cd50df6b211f6dce. A leased fixture explicitly seeded four workspaces, quit while keeping sessions, and relaunched into a distinct process with the third row selected and no prior Cmd-N openings. The first real Cmd-N went through the app key router. -
The new row first appeared at zero-based index 3, stayed there in every motion sample containing the new row, and settled at index 3. The continuous trace contains 396 motion samples; the native frame strip contains 111 composited images from -4 ms to 665 ms, with 0 blank frames, 0 jumps, and 0 reversals. Primary inspection of before/after and early transition frames agrees. Receipt:
cold-runtime-a6f4815-r2/receipt.json(SHA-25615d6ad8c995e1a45dcb6a7099a710399fe6ff2baf0c9ae8aaa9a0b6497f2feaa); capture leaseslot-cmux11s-mac-mini-b9d6640056f8was released.
No capture: no public media attachment. Native captures and traces are retained in the task artifacts; the trusted main privacy preflight still reports no configured agent-author list, and the earlier public upload failed that prerequisite (run). No media was uploaded. This successful run uses a tagged DEV build and a leased cold-relaunch adapter, not a NIGHTLY or baseline comparison. It verifies the expected behavior on this head without establishing red/green reproduction of the original report.
Impact map
SidebarBridge.place uses the sidebar document's accepted reorder before the legacy fallback. SidebarDocMachines.place reprojects current live references through SidebarDocStore.reshow. The refresh updates the shown projection and adopts unplaced rows; live-set and remote-close detection remain owned by show. The risk is creation/reconciliation ordering. No persistence format, protocol, or user-facing strings change.
Review and mergeability
- Correctness subagent: SHIP at the exact head; primary review independently inspected the diff and surrounding bridge/store paths and agrees. Review receipt.
- Historical integration at the pre-rebase head: merged
feat-cmux-nextbased512fd7827427723178ab5c5366d720866faef54into the existing branch with normal merge commits using GitHub's merge API after shared local Git stalled. No history rewriting or force push. - Latest HQ conflict-only gate: PASS against base
b8b2076dc867299185a042377992841e6f1b3087, heada6f4815bf69486b91ebb866536e5f1610d013125; speculative mergefc7f6e2021491b7ce789de63cc953922f10d99d6.
The remaining CI assertions are outside this PR's seven-file diff; the broad app run also ended without a helper summary:
- Static checks: No new SwiftUI in
HomeChatColorsPanel.swiftandHomeChatColorsView.swift, plus the package dependency-list check inPackages/macOS/CmuxNext/Package.swift. These files have identical blobs on base and head. The pushed-commit violation check passes. - Broad Swift run: stale action catalog/export assertions, a compact footer geometry assertion, an app test helper ending without a final summary, and
ModelRouterModelSettingTestsexpecting an unconfirmed settings write now rejected assetting_user_only. Action catalog/export, footer, and model-router behavior are unchanged by this diff; the model-router test is the identical blob on base and head. The focused affected suites pass as recorded above.
Performance
No perf numbers: this change corrects placement timing. No latency or throughput improvement is claimed; the focused fleet suites check ordering through daemon confirmation.
Changelog
Fixed: keep the first new workspace after launch beside the selected workspace.