Project each sidebar row once when the sidebar reopens
Revealing the workspace sidebar projected every row twice. SidebarHiddenPresentationTests/visibilityToggleKeepsAppKitTableContainerMounted has recorded 10 projections for 5 workspaces since at least 2026-09-09, both passes landing in the first run-loop turn after sidebarState.toggle() with none of the async sidebar inputs in flight.
The AppKit sidebar builds each row through SidebarWorkspaceSnapshotFactory, which calls Workspace.sidebarOrderedPanelIds() from inside VerticalTabsSidebar.body. That called bonsplitController.treeSnapshot(), and treeSnapshot() reads SplitViewController.containerFrame so it can turn normalized node bounds into pixel rects. The sidebar body therefore observed split-container geometry โ and showing the sidebar is itself a resize of the content area, so the reveal invalidated the body it had just finished running. The measured interval on main a9b0329691 (run 35821359659, shard 2/7) printed exactly that pair:
VerticalTabsSidebar: @self, _selection changed.
VerticalTabsSidebar: \SplitViewController.containerFrame, _selection changed.
Resulting behavior
orderedPanelIds never used a frame: it walks pane order, then tab order within each pane, then a stable fallback. BonsplitController.allPaneIds reports the same depth-first first-then-second recursion the tree snapshot reports, and reads no geometry. sidebarOrderedPanelIds() now orders from it through a new SpatialPanelOrder, and ExternalTreeNode.orderedPanelIds(paneTabs:fallbackPanelIds:) delegates to the same type so the two paths cannot drift.
A sidebar reveal now projects each workspace row once, and resizing the terminal area no longer invalidates the sidebar root. This is the invalidation class CLAUDE.md ties to the 100% CPU spin loop in #2586, so the assertion is left exactly as it was.
Validation and remaining gap
I did not execute these tests. swiftc -parse is clean on all four changed files, ./scripts/lint-ios-package-conventions.sh and scripts/check-sidebar-lazy-layout.py pass, and Linux cannot type-check AppKit or run the app-host shards. SpatialOrderTests.spatialPanelOrderMatchesTreeDerivedOrder asserts the pane-order path and the tree path agree on the same fixture, but it is a package test, not the app-host contract โ the app-host lane is what has to confirm the projection count.
The sibling Workspace.spatiallyOrderedPaneIds still goes through treeSnapshot(). It feeds pane navigation from user actions rather than a SwiftUI body, so it is not part of this invalidation edge and is left alone.
WorkspaceContentViewVisibilityTests/testMinimalModeToggleDoesNotReevaluateChromeHeavyBodies is the other chronic app-host failure and is not addressed here; it has a separate root cause, recorded in #13930.
โ Zarathustra g1 ๐ฑ
Run: run_cmux_mainred_triage_20260923_c6
๐ค Generated with Claude Code
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.
Summary by cubic
Fixes the workspace sidebar reveal projecting every row twice.
Revealing the sidebar is itself a content-area resize, so the old sidebarOrderedPanelIds() โ which read treeSnapshot() and its live SplitViewController.containerFrame โ invalidated the sidebar body it had just run. The new SpatialPanelOrder walks BonsplitController.allPaneIds's depth-first pane order without touching geometry, and ExternalTreeNode.orderedPanelIds now delegates to the same type so the two paths cannot drift. Workspace.spatiallyOrderedPaneIds still reads the tree snapshot; it feeds navigation from user actions, not a SwiftUI body, so it is left unchanged.
Bug Fixes
- Resizing the terminal area no longer re-runs the sidebar root.