agent pane: keep a Claude workflow's run, phases and agents in the subagent model

Merged
TE
12d ago
+268-3

Leo, 2026-10-24: "lawrence also sent some of this stuff with dynamic workflows claude "trajectories" ... we can use that to help think about how cmux-next/acpmux wants to expose/reveal/render dynamic workflows... we can look at claude code desktop and see how we can do better". Design: manaflow-ai/cmuxterm-hq#3720.

This is the pane-side reader of the workflow-agents-v1 contract that #24789 (landed) added to acpmux.

What changed

The subagent fold (subagents/subagentFold.ts) now keeps a Claude workflow's data on its Subagent:

  • runId;
  • scriptPath and args, which a resume names again. The fold keeps them when acpmux sends them; the producer is the follow-up to #24789.
  • phases ({index, title}, in order);
  • workflowAgents, a ReadonlyMap by index (subagents/workflowAgents.ts):
    • each update's changes merge into a new map;
    • a field set to null is removed, and a field of the wrong type is ignored;
    • an update marked workflowAgentsFull (the run's end) replaces the map, so a pane that read only recent history still has every agent;
  • the failed and queued counts;
  • paused, when Claude Code paused the run (reason: "paused").

Rows are keyed by the workflow subagent's id plus the agent's index. The key is never runId alone, because a resumed run is a new subagent with the same runId. An older acpmux sends none of these fields, and then nothing changes.

UI: none. This only keeps data on the fold. Nothing in the default UI reads it: the Labs workflow summaries read it in #24874, which carries its own captures. So there is no before/after to capture here.

Risk: low. Data only, with the merge logic covered by tests.

Testing

  • bun test src/agent-session/acpmux/subagents/workflowAgents.test.ts src/agent-session/acpmux/subagents/subagentFold.test.ts at the rebased head: 21 passed. Five tests are new:
    • merging by index;
    • null removes a field and a wrong type is ignored;
    • a full update replaces the map;
    • phase order;
    • the fold keeps run, phases, agents, counts and pause, including a pane that saw only the run's end.
  • tsc --noEmit -p webviews/tsconfig.json: no findings in the changed files.
  • scripts/cmux-next/prepush-gate.py: no new violations.
  • An earlier cross-model review (Codex, xhigh, read-only) returned SHIP-as-draft. A fresh merge review at the head follows.

Agent session: huge-blue

šŸ¤– Generated with Claude Code