cmux-next sidebar: the Chief's workspaces are one collapsible Chief group

Merged
TE
16d ago
+113-5

Summary

The Chief's subagent workspaces now form one collapsible "Chief" group in the one-list sidebar. Before, they sat loose after the last local group. Right-clicking one of them ends with "Started by Chief". This is part 2 of Leo's 2026-10-21 ask; part 1, which drops the aN · id and the "Chief" second line, is #23391.

Why

The Chief's workspaces live on the local Chief owner daemon, which the sidebar treats as a machine (server-host_chief…). In the one-list sidebar (sidebar.groupByComputer off), another computer's section has no header. So these rows drew straight after the last local node, which in Leo's sidebar is the collapsed "Codex" group, and looked like they belonged to it.

What changes

  • One rule for headers: SidebarLayout.keepsHeaderInOneList(section) decides whether a machine section keeps its header and fold in one list. That is true for a remote group the person made (isHostGroup, as before) and for the local Chief's section (MachineID.isLocalChief, from #23391).
  • SidebarLayout.make: only the flat and showsHeader lines read this rule. No member loop changed.
    • The Chief section draws its section header, titled "Chief" (HomeStrings.chiefName).
    • Its collapse goes through the existing per-window collapsedSections, so it persists like any section's.
    • The groups and folds coming in chief-sidebar's sidebar-organization set ("Done (N)", per-group "Show more") apply to it like any headed section. chief-sidebar agreed to build those on top of this.
  • Context menu: a single selected Chief row's menu ends with a disabled "Started by Chief" line (ChiefWorkspaceName.startedBy, the hover card's string).

Testing

  • New ChiefGroupLayoutTests:
    • In one list, the Chief's rows follow their own header, while this Mac and an SSH machine draw none.
    • A collapsed Chief section hides its rows and its header reads collapsed.
    • The rule covers the Chief section and remote groups and nothing else.
  • The fleet compile-check of the app passed at e3041bdf, before the base merge.

No capture: this changes only the local Chief machine's section and its rows' menu. A capture slot runs the app with its own HOME and no Chief home, so that section never exists there and a capture would show an unchanged sidebar. ChiefGroupLayoutTests covers the layout.

Agent session: cosmic-gray

🤖 Generated with Claude Code


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


Summary by cubic

Groups the Chief's subagent workspaces under their own collapsible "Chief" header in the one-list sidebar, so they no longer sit loose after the last local group and read as its members. Right-clicking a Chief workspace now ends with a disabled "Started by Chief" line, matching its hover card.

  • One rule, SidebarLayout.keepsHeaderInOneList, now keeps the header and fold for remote groups and the local Chief's section; other computers' sections still draw none.
  • An empty Chief section draws nothing, its header has no + button, and rows after it are set apart from the next computer.
  • ChiefGroupLayoutTests covers header placement, folding, the empty state, and spacing.