Skip to content

feat(agents): Draw the run canvas as a real dispatch tree - #121

Merged
4ndreello merged 1 commit into
mainfrom
claude/workers-visualization-f8b1c3
Sep 25, 2026
Merged

4ndreello merged 1 commit into
mainfrom
claude/workers-visualization-f8b1c3

Conversation

@4ndreello

Copy link
Copy Markdown
Owner

Summary

Every session in a run shared one runId, the open session's id. When a worker ran codedeck run itself, the child inherited that same CODEDECK_RUN_ID. The agents pane showed every worker as a direct child of a card with a hardcoded "Orchestrator" label. So a reviewer started by a general worker looked like the root had started it.

This PR records lineage and draws it as a tree.

  • Store: new parent_id and role columns on sessions. They are added to existing databases through addMissingColumns.
  • codedeck run: sends parentId, taken from CODEDECK_SESSION_ID (which every worker harness already has) or else CODEDECK_RUN_ID, plus role = parseRole(--role).
  • open: sets CODEDECK_SESSION_ID to its own id and sends its role on session.adopt.
  • Daemon: records parentId only when that session exists in the store. When the request has no runId, it inherits the parent's.
  • Pane (plugin/mods/agents/pane.ts):
    • Each card hangs from its dispatcher, joined by elbow connectors.
    • The root card shows the open session's role and falls back to "Orchestrator".
    • Worker cards show their role.
    • A finished worker stays a card while any descendant is live.
    • History lines show ← parent.
    • When the pane is short, a card is evicted only after its children.
    • A parent missing from the snapshot, or a parent loop, falls back to the root.

Spec: .specs/features/worker-lineage/spec.md.

┌──────────────────────┐
│  General             │
└─┬────────────────────┘
  │ ┌───────────────────────────┐
  └─┤  a1b2  General · Claude   │
    └─┬─────────────────────────┘
      │ ┌─────────────────────────┐
      └─┤  c3d4  Reviewer · Codex │
        └─────────────────────────┘

Notes

  • Sessions created before this change have no parentId, so the pane draws them under the root.
  • Three existing pane tests change their height thresholds because the tree no longer spends a stem line between cards.
  • Out of scope: moving reviewer dispatch into the harness, and the web console canvas.

Test plan

  • npm run build
  • New tests pass: tests/daemon-lineage.test.ts, the lineage cases in tests/mods-agents/pane.test.ts, and the parent/role cases in tests/run-role.test.ts
  • Full vitest run: 1573/1574. The one failure, in tests/open-claude-probes.test.ts, fails the same way on the base branch
  • scripts/pty-gate.sh

🤖 Generated with Claude Code

https://claude.ai/code/session_01QuWLN5K2HAo94s16Bb9HRU


Generated by Claude Code

Every session of a run shared one runId, and a worker's own `codedeck run`
inherited it, so the pane drew every worker as a child of an "Orchestrator"
card. Sessions now record parentId (from CODEDECK_SESSION_ID, falling back
to CODEDECK_RUN_ID) and role, and the pane hangs each card from the session
that dispatched it, labelling the root with its real role.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QuWLN5K2HAo94s16Bb9HRU
@sonarqubecloud

Copy link
Copy Markdown

@4ndreello
4ndreello merged commit 33763d3 into main Sep 25, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants