feat(desktop): agent tree in the sidebar agents chip and the pane subagents menu
KI
2mo ago+1638+1638+0123456789012345678901234567890123456789-205-205-012345678901234567890123456789
Links
- Issue: https://github.com/superset-sh/superset/issues/7481
- Design + live screenshots: https://app.superset.sh/page/tree-mode-for-the-subagents-pill-d04ka4
- Stacked on: host-service roster PR (
agent-tree-roster), which supplies the parent pointer, status and activity this UI renders
Summary
- New shared
AgentTreecomponent: agents → subagents → nested subagents with connector rails, fold chevrons, state glyph, harness title, activity line and elapsed time. Arrow keys move, ←/→ fold, Enter opens. - The sidebar agents chip's card renders that tree with an "N ended" section and a Show tree in sidebar switch; switch on renders single-line rows under the workspace's activity line. The chip's
+Ntakes the worst child state's colour. - The pane header's "N subagents" menu renders the same tree. The two hand-rolled row lists are deleted.
Why / Context
#7481: nested subagents are hidden, stateless and unmanageable. The chip's card showed one level with every child labelled "Subagent", and the pane menu a flat list where every row said "Running". This is the rendering half of the change; the data comes from the stacked host PR.
How It Works
buildAgentTree(roots)(pure, tested) nests byparentSubagentIdwith a cycle guard, re-roots a child whose parent left the roster, omits the agent row when there is a single terminal agent, and promotes an ended parent back into the live tree while any descendant still runs (Claude launches Agent-tool children in the background, so the parent's turn ends first).AgentTreeRowdraws rails per ancestor level; the sidebar variant is single-line with type, activity and "Parent unknown" in a tooltip; card and menu variants carry the activity line.useDashboardSidebarWorkspaceAgentTreekeeps the existing chip gate (2+ agents or any subagent, live or recently ended) and computes the worst child state for the+N.- The switch is
sidebarState.agentTreeShownon the workspace local-state row (healed tofalse), with the same session-only zustand fallback the sidebar tab uses for a rowless localmain(stores/sidebar-agent-tree.ts, not persisted, so no registry entry). formatCompactDurationjoins@superset/i18n/formatfor "42s" / "3m" / "2h" viaIntl.NumberFormatunit narrow.- Six new strings translated into all 16 non-English catalogs;
bun run check:i18npasses.
Manual QA Checklist
Dev desktop from this worktree, driven over CDP, Claude Code 2.1.270 in a real workspace, three fan-out prompts (screenshots on the page).
- Chip shows
2 +5with two terminal agents and five live children - Card: three-level tree, titles from Task descriptions, activity lines, elapsed, ended section, switch
- Switch on → rows under the workspace; type/activity in tooltip; "10 ended" folded by default
- Switch survived a relaunch of the dev app (local-state row)
- Pane menu: same tree rooted at the terminal, "5 live · N ended" header
- Clicking a nested row opened its transcript pane beside the parent; a second click focused the existing pane
- No console errors during the session
-
+Nyellow / red (no child needed input or failed in the bypass-permissions session) - Codex end to end
Testing
bunx tsc --noEmit -p apps/desktop/tsconfig.json(only the pre-existing generated file-icons manifest error remains)bun testdesktop: AgentTree, DashboardSidebar, CollectionsProvider, persisted-keys suites → 275 passbun testinpackages/i18n→ 160 pass (incl.formatCompactDuration)bun run check:i18nbunx biome checkon the touched directories
Design Decisions
- Switch on the card, not a chip click: the chip's click already toggles the card; a labelled switch says what it does and makes the state legible.
- Inline rows, not a bigger card: a card closes when the pointer leaves, which is when a supervisor wants to watch five children. Rows are not sortable so they never interfere with workspace drag.
- Popover instead of DropdownMenu for the pane menu: Radix menu key handling would fight the tree's roving focus.
Known Limitations
- The focused pane's row is not highlighted (
selectedKeyis wired but nothing supplies it yet). - Terminal agents read Idle while their background children run; that is Claude's main-loop Stop, the children's state is in the tree.
Follow-ups
- Persist the roster in host.db so the tree survives a host-service restart.
- Terminal children (
parentTerminalId) so CLI-spawned agents appear in the tree with full stop/restart/input. - A Settings → Sidebar default for the switch.
https://claude.ai/code/session_01GojHrw82odVV1wVhJQdgaM
Summary by cubic
Renders nested subagents as a tree in the sidebar agents chip card and the terminal pane's "N subagents" menu, replacing the flat one-level lists that labelled every child "Subagent" and "Running" (fixes #7481).
- Adds a shared
AgentTreecomponent (agents → subagents → nested subagents) with connector rails, fold chevrons, status glyph, harness title, activity line, and elapsed time; arrow keys move, ←/→ fold, Enter opens the node's transcript or terminal. - Builds the tree from
parentSubagentIdwith a cycle guard; orphans re-root under the agent; an ended parent stays dimmed in the live tree while any descendant still runs. - The chip's
+Ntakes the worst child state's colour; a "Show tree in sidebar" switch keeps the tree open as single-line rows under the workspace, persisted in the workspace's local-state row (session-only fallback for rowless local mains). - The pane menu now uses a popover (Radix menu key handling fought tree roving focus) and shows "N live · M ended" in the header.
- Adds
formatCompactDurationfor "42s"/"3m"/"2h" and translates six new strings into all 16 non-English catalogs. - Depends on the host-service roster PR (
agent-tree-roster) for the parent pointer, status, and activity this tree renders.