cmux-next sidebar: Cmd-N row stays where it draws (sidebar document placement)

Draft
LA
6d ago
+103-14

Summary

Lawrence, 2026-10-18, on NIGHTLY: after Cmd-N the new row first drew above the "Accounts & billing" group, then moved below "Scratch".

Root cause: on the sidebar document (sidebar-doc-v1), SidebarBridge.place (Windows/SidebarBridge+Windows.swift) sent the workspaces.newPlacement slot to the personal order (placePersonal, workspace_placement). The document path does not show that order. The new workspace listed in the document's unplaced tail, after every group (SidebarDocSections.sections), and the daemon's legacy-to-document sync then put it where its personal neighbour mapped. The press row (PendingWorkspaceRows) drew at the real slot (top: first in the machine section, which here starts with "Accounts & billing"), so the row jumped.

Fix:

  • On the document, SidebarBridge.place goes to SidebarDocMachines.place: one sidebar.apply (adopt + move, no undo step) at the slot the row drew at. The store then rebuilds shown in the same turn (SidebarDocStore.reshow), so the sidebar never lists the workspace in the unplaced tail first. applyPendingPlacements runs synchronously from the workspace-list change, before any observer.
  • bottom outside a group is now placed at the end of the loose rows, where its press row draws. Before, it was left to the daemon, whose place on the document is the end of the machine section, after every group. Now the press row and the placement use one slot under every setting value.
  • A drop from another window (accept) also goes through place, so on the document it now lands where it was dropped.

Bead: cx-qbktz.

Testing

  • Red commit: RapidWorkspaceCreateTests.cmdNRowStaysWhereItDrewAtThePress (same-tree daemon, app action newTab, samples the rows the sidebar model draws until 2 s after the row is the workspace's own). It expects one place.
  • Results: see the comments below.

Changelog

  • Fixed: A new workspace's sidebar row no longer jumps to another place after it appears.

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

Fixes the cmux-next sidebar so a Cmd-N workspace's row stays where it drew at the press instead of jumping to another slot after it appears, on the sidebar document.

Changes

  • SidebarBridge.place now routes document placements through SidebarDocMachines.place: one sidebar.apply (adopt + move, no undo step), then rebuilds shown in the same turn, so the new row never draws in the unplaced tail first.
  • bottom outside a group places at the end of the loose rows, matching the press row, and drops from other windows land where dropped on the document.