cmux NEXT sidebar: agent-started sessions nest under their parent by default
Leo's words (ask-18a79e54a3):
"ALSO NEED YALL TO HELP ORGANIZE THIS MF SIDEBAR AND ALSO THINK ABOUT WAYS YOU'D IMPROVE THE WHOLE SITUATION WHAT MORE YOU'D WNAT EXPOSED WHAT MORE CAPABILITIES YUO'D WANT... ESP BY AUTO... A LOT OF THESE SESSIONS ID IMAGINE DIDNT NECESSSARILY NEED TO SHOW UP ON THE SIDE BY DEFAULT, THO IK THESE WEREN'T SUBAGENTS BUT STILL.."
Leo-ask: ask-18a79e54a3
PR 3 of the session-lineage brief (leo-workspace briefs/2026-10-20-gui-push/session-lineage.md). It builds on #21836's deep tree (folds, roll-ups) and #23633's Done fold, and doesn't duplicate either.
What changes
- Nesting is on by default. Before, it only ran behind
sidebar.sessionTree, which is off. Now a workspace whose agent was started by another workspace's agent (acpmuxspawnedBy, plus remote daemons' parents, the same data #21836 reads) lists under that workspace at any depth. Only workspaces a person started stay top level. - Collapsed below depth 1. A top-level parent shows its direct children. A parent at depth 1 or deeper starts folded, so a coordinator shows its lanes and each lane's sub-sessions and reviewers stay in the lane's fold. A folded parent shows a disclosure chevron and a count chip with how many sessions it hides (new, idle ones included). The existing per-state roll-up chips sit next to it.
- Fold state persists per parent. The existing
sidebar.sessionTree.collapsedlist is joined by asidebar.sessionTree.openedlist for deep parents the user opened. Both are pruned to live parents. Selecting a hidden session (Cmd-K, a notification, Cmd-number) opens the folds above it, asrevealalready did. - Debug toggle: Debug Settings → Sidebar → "Nest agent-started sessions" (
sidebar.lineageNesting), on by default. Off, every workspace is top level again, even withsidebar.sessionTreeon. sidebar.sessionTreekeeps its other parts. Keycaps, chat history (Pinned/Earlier) and the tree's pull-request reads are unchanged and still opt-in. Nesting on its own makes no GitHub calls.- Done fold and row limit with nesting. They used to switch off whenever the tree was on. Now they work on whole subtrees: a Done top-level row takes its subtree into "Done (N)", and a Done child stays under its parent. "Show N more" counts a subtree as one row.
- Group members nest and fold the same way. A group whose members nest is laid out in full instead of spliced.
Not in this PR: the subtree roll-up wording ("N running · M need you · K merged") and Parked are PRs 4 and 5 of the brief. Lineage beyond spawnedBy comes from #24150 and #24136, which are still open; this PR doesn't depend on them.
Tests
SidebarLineageNestingTests (new) covers:
- coordinator → lane → sub → reviewer at depths 0–3
- the default fold below depth 1, and the count and state roll-up
- opening one level at a time
- group members
- a filter opening deep folds
- the Done fold moving whole runs
- toggle persistence, and
revealopening deep ancestors - the Debug toggle's default and its off path (flat list, no GitHub reads)
The existing SidebarDeepTreeTests and SidebarSessionTreeTests keep passing as written.
Exact-head verification and captures
Head: 17c0923e1f0e4525aeaf5fd6bd97c4481e8bdc0f. Independent Astra review: SHIP. Native fleet step 7f255fcd841cb3f22f52a001 passed all four focused suites: SidebarLineageNestingTests, SidebarDeepTreeTests, SidebarSessionTreeTests, and SidebarNeedsYouTests. Static pre-push and Objective-C selector checks passed.
The real app captures below use the existing needsYou parent-child fixture with sidebar.sessionTree=false on both commits. Before (4c12180f1237a344e69f73d743c5f4f3c3969f60), all sessions are flat. After, Settings pass and Release notes nest under Release week, and their children Shrink large files and Changelog start folded behind count chips. This demonstrates the new default; it is fixture-seeded evidence, not a live agent spawn recording. Reference: Claude's linked-session nesting (apps/claude/live/sidebar-linked-session-nesting.png); private reference media is not reproduced here.
| Before | After |
|---|---|
![]() | ![]() |
![]() | ![]() |
Remaining checks: the independent reviewer published its exact-head SHIP, and the defaults guard passed. After #25861 merged, one retry of the failed broad Swift job failed again: no test-run summary, 926 tests unfinished, plus failures in SidebarPriorityMotionTests.aRowRetargetedWhileItOpensClipsUntilWhole (line 223) and FileExplorerEditTests.newFileAndNewFolderMakeUntitledItemsAndSelectThem (lines 74–75). This incomplete run is not excused as a base red. The frozen head does not include #25861's run-loop guard; incorporating that recovery requires a new head and review. The focused four-suite success above remains separate evidence. Both the Swift dependency hold (#26809) and the outstanding exact-head validation hold remain; no further rerun or source change has been made.
Risk: nesting changes default sidebar organization and the handling of deep folds; explicit/manual folds, selected-workspace reveal, same-list ancestry, and PR-read gating are covered by the focused tests.
Changelog
Changed: Sessions an agent starts now nest under the session that started them in the sidebar, with deeper levels folded. Debug Settings can turn this off.
🤖 Generated with Claude Code
![View with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/view-with-codesmith-dark-v3-3x.png)
![Autofix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark-3x.png)
Need help on this PR? Tag @codesmith-bot with what you need.
Summary by cubic
Makes agent-started sessions nest under the workspace whose agent started them, by default. Previously nesting only ran behind the opt-in sidebar.sessionTree setting; now every workspace an agent started lists under its parent at any depth, and only person-started sessions stay at the top level. A parent below the top level starts folded behind a count chip and its state roll-up; open/fold state persists per parent.
New Features
- Nesting follows the row's own list: a workspace listed twice nests per list, and a chain or cycle never crosses lists.
- Debug Settings toggle
sidebar.lineageNesting(on by default) turns nesting off; nesting alone makes no GitHub calls and draws no keycaps or chat history, which staysidebar.sessionTree's. - The Done fold and row limit now treat a subtree as one row, and group members nest the same way; an idle-only roll-up is no longer empty.
- Selecting a hidden session opens the folds above it; lineage arriving after the selection reveals it too, and dragging or regrouping the selection into a deep list opens its new folds. A fold the user makes later stays.
Agent session: agent session



