cmux-next sidebar: Cmd-N row stays where it draws (sidebar document placement)
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.placegoes toSidebarDocMachines.place: onesidebar.apply(adopt + move, no undo step) at the slot the row drew at. The store then rebuildsshownin the same turn (SidebarDocStore.reshow), so the sidebar never lists the workspace in the unplaced tail first.applyPendingPlacementsruns synchronously from the workspace-list change, before any observer. bottomoutside 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 throughplace, so on the document it now lands where it was dropped.
Bead: cx-qbktz.
Testing
- Red commit:
RapidWorkspaceCreateTests.cmdNRowStaysWhereItDrewAtThePress(same-tree daemon, app actionnewTab, 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.
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.placenow routes document placements throughSidebarDocMachines.place: onesidebar.apply(adopt + move, no undo step), then rebuildsshownin the same turn, so the new row never draws in the unplaced tail first.bottomoutside 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.