Leaders list: acpmux ls --leads and a Leads list on New Tab

Merged
TE
4d ago
+749-27

Leo: "i need to be able to see and talk to the leaders of every respective thing"

What

  • acpmux ls --leads (cli/run/ls_leads.rs) lists the leaders, each once, with its machine, state, area tag and the names of the sessions that report to it. The leader with the most reports comes first. --json / --fields rows are the daemon's rows plus reports.
  • A "Leads" list on New Tab (AllChatsList): every leader once, above the live chats, with "N reporting". A press (or right-click > Open) opens that chat the same way a live chat row does. It shows under the All filter with no search.

Rule. A leader is a live session that at least one live session reports to. "Reports to" means the lane's lane.reportsTo tag, which the daemon sets on every lane a session starts (hub/lane_reports.rs), matched on the lane's own machine as (peer, id). The rule is derived from that tag, not from a hand list. The CLI and the web (acpmux/leads.ts) apply the same rule to the same row fields. Closed, archived and side chats never count. A session tagged as reporting to itself does not make itself a leader.

Audit (systems of record)

  • leo-workspace machines/fleet-registry.json coordinators.
    • It names current (the coordinator) and retired.
    • Its own note already says that a coordinator host's send targets are derived from acpmux: "a live session that hands out work", meaning another live session reports to it or was spawned by it. That is the same rule as here.
    • No deputy or area-owner list exists by hand, and none is added.
  • acpmux ls --json. Rows carry tags (lane.reportsTo on lanes; area is free-form and often just the lane's own name), parent and spawnedBy (lineage), startedBy (sub-sessions) and children (open sub-sessions).
    • On one lane host, 90 live sessions derive 7 leaders: the area owner with 13 reports, a dispatcher with 4, two cloud owners with 7 and 4, and three with 1 to 3.
    • lane.reportsTo is the one link every acpmux new lane carries. spawnedBy is dropped once the parent is not a listed root.
  • App.
    • The sidebar "Leads" groups in Leo's screenshot are workspace groups made by repeated acpmux new --group Leads opens. Their reuse and duplicate rows are a separate fix in progress; this PR does not touch them.
    • cmuxExec.ts only titles cmux_exec transcript rows.
    • AllChatsList (New Tab / History) already has a live-chats list that opens a chat on click. A second list beside it is the least new UI: no new surface, no sidebar change, nothing hidden or closed.
  • Session entry. It gains reportsTo (the tag). No other entry field changes.

Not covered

A coordinator whose lanes run on other machines and carry no lane.reportsTo is a leader only on the machine where its lanes report to it. sessions new --machine lanes do not tag a remote parent yet.

Tests

The tests were committed first, in 34b84e2 (red on base: ./leads missing, no .nt-all-leads). They are green at the head.

  • bun test src/agent-session/acpmux/leads.test.ts src/agent-session/acpmux/newtab/leadsList.test.tsx: 6 pass.
  • Neighbouring suites (AllChatsList, NewTabScreen, sessionList): 46 pass.
  • bun run typecheck and scripts/web-lint.sh pass.
  • Rust unit tests are in ls_leads.rs (derivation, closed and archived exclusion, per-machine match, text view). They run on the fleet; results are below.
  • Gallery: agent-pane.all-chats-list gains a leads variant.

Observed / Not run

  • Observed: the web tests, type check and lint above, and the live leader count on one lane host computed from acpmux ls --json.
  • Not run yet: the Rust suite (fleet run pending) and the app capture.
  • iOS: New Tab is a Mac pane, so this list has no phone row yet (follow-up).

Changelog

  • Added: New Tab lists the leaders (the chats other chats report to) and opens one on click; acpmux ls --leads prints them.

Design spec: leo-workspace design/new-tab.md (no settled design changes; adds one list in the existing live-chats style).

Agent session: agent session

šŸ¤– 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

Adds a "Leads" list to New Tab and the acpmux ls --leads command so you can see and open the chat each session reports to.

A leader is derived, never hand-listed: a live session that at least one live session reports to, via the lane.reportsTo tag. The CLI and web derive the same rule from the same row fields, matched on the same machine as (peer, id). Closed, archived, and side or aside chats never count as leaders or reports, and a session tagged as reporting to itself does not make itself a leader.

New Features

  • acpmux ls --leads lists each leader once with its machine, state, area tag, and reporting session names, most reports first; it reads only live rows and conflicts with the other listing filters.
  • New Tab's "Leads" list sits above the live chats with an "N reporting" label; a press or right-click > Open opens that chat. It shows under the All filter with no search.