Skip to content

refactor(review): multi-agent picker, orchestrator, and live TUI (1/2)#1111

Open
peyton-alt wants to merge 2 commits intofeat/entire-review-v2-a3from
feat/entire-review-v2-b1
Open

refactor(review): multi-agent picker, orchestrator, and live TUI (1/2)#1111
peyton-alt wants to merge 2 commits intofeat/entire-review-v2-a3from
feat/entire-review-v2-b1

Conversation

@peyton-alt
Copy link
Copy Markdown
Contributor

@peyton-alt peyton-alt commented May 4, 2026

First of two stacked meta-PRs that build the new multi-agent review on top of the PR-A redesign foundation. Stacked on #1107 (A3) — when A3 merges, this PR auto-retargets to its merge target.

The full redesign behind #993/#1018 is split across 5 stacked PRs:

When all five merge, the work targeted by #1018 ships as part of the redesign on feat/entire-review (#993). #1018 itself becomes obsolete and can be closed.

What's in this PR

  • CU8 — multi-select agent picker, optional per-run prompt field, RunMulti N-agent orchestrator. Each goroutine streams events into a single dispatch loop so the Sink serial-dispatch contract is preserved without per-sink synchronization. perAgentConfiguredReviewer adapter injects per-agent skills/prompt despite RunMulti's shared-config API.
  • CU9 — Bubble Tea TUI sink: live dashboard with one row per agent (status, tokens, last preview, duration). Ctrl+O enters drill-in mode on the alt screen showing the full event buffer; Esc returns. Ctrl+C cancels through the shared CancelFunc. tea.WithoutSignalHandler keeps cobra's SIGINT routing intact. After all agents finish, the user dismisses with any key — RunFinished blocks on dismissal so the post-run DumpSink narrative renders below the TUI rather than overlapping it.

Smoke tests

  • Configure 2+ launchable agents in .entire/settings.json (e.g. claude-code + codex)
  • Run entire review — multi-select picker appears with the per-run prompt field
  • Select 2+ agents → TUI dashboard shows one row per agent with live status updates
  • Press Ctrl+O to drill into a specific agent's event buffer; Esc returns
  • Press Ctrl+C mid-run — all agents cancel cleanly, TUI exits
  • After agents finish, press any key to dismiss → post-run narrative dump renders below
  • Run entire review --agent claude-code — single-agent path, no multi-picker
  • Run with non-TTY stdout (entire review > out.txt) — no TUI, just narrative dump
  • Run mise run check — lint clean, tests green

🤖 Generated with Claude Code


Note

Medium Risk
Adds a new multi-agent execution path with concurrency, new UI flows, and new sink/orchestration logic; main risk is race/cancellation edge cases and altered CLI routing, though changes are well-covered by tests.

Overview
entire review now forks between single-agent and multi-agent execution: when 2+ launchable eligible agents are configured and --agent is not provided, it prompts with a new multi-select picker (plus optional per-run prompt) and runs all selected agents concurrently.

Introduces RunMulti, a multi-reviewer orchestrator that fans N agent event streams into a single serial dispatch loop to preserve the existing Sink contract, aggregates per-agent results into RunSummary, and returns the first non-cancellation error.

Adds a new Bubble Tea TUISink used in TTY multi-agent runs to show a live dashboard (status/duration/tokens/preview) with a drill-in detail view; non-TTY runs continue to use DumpSink. Tests were expanded substantially to cover dispatch routing, picker error sentinels, orchestrator behavior (ordering/serial dispatch/cancellation), and TUI rendering/controls.

Reviewed by Cursor Bugbot for commit b423db9. Configure here.

Copilot AI review requested due to automatic review settings May 4, 2026 23:06
@peyton-alt peyton-alt requested a review from a team as a code owner May 4, 2026 23:06
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of lines (20,000). Try reducing the number of changed lines and requesting a review from Copilot again.

Comment thread cmd/entire/cli/review/picker.go
Comment thread .github/workflows/e2e-checkpoints-v2.yml
Comment thread cmd/entire/cli/review/picker.go
Comment thread .github/workflows/e2e-checkpoints-v2.yml
@peyton-alt peyton-alt changed the base branch from feat/entire-review-multi-agent to feat/entire-review-v2-a3 May 4, 2026 23:09
@peyton-alt peyton-alt closed this May 5, 2026
@peyton-alt peyton-alt reopened this May 5, 2026
@peyton-alt
Copy link
Copy Markdown
Contributor Author

@BugBot review

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit b423db9. Configure here.

Comment thread cmd/entire/cli/review/cmd.go Outdated
… PR-B)

CU8 adds the multi-agent path: when 2+ launchable agents are configured
and no --agent override is given, prompt the user to multi-select agents
and optionally collect a per-run prompt, then run them concurrently.

  - review/multipicker.go: PickAgents() shows a huh multi-select pre-
    checking all eligible agents, then a per-run prompt textarea. Sorts
    eligible alphabetically for stable order. Returns ErrPickerCancelled
    or ErrNoAgentsSelected on the corresponding user actions.
  - review/run_multi.go: RunMulti() runs N reviewers concurrently. Each
    agent runs in its own goroutine; events from N goroutines fan in to
    a single dispatch loop that calls every sink serially (preserves the
    serial-dispatch contract from CU4 even under concurrent emission).
    Cancellation propagates through ctx. Aggregates per-agent runs into
    a populated RunSummary; sinks always get RunFinished.
  - review/picker.go: computeLaunchableEligible filters s.Review to
    agents with hooks installed AND ReviewerFor != nil.
  - review/cmd.go: dispatch fork. When --agent is empty and 2+ launchable
    agents are eligible, route through PickAgents + RunMulti via
    runMultiAgentPath. perAgentConfiguredReviewer adapter injects per-agent
    skills/prompt into RunConfig at Start time. runSingleAgentPath and
    detectScope extracted to keep runReview under the maintidx threshold.
    handlePickerError maps ErrPickerCancelled to nil (silent exit) and
    ErrNoAgentsSelected to a user-facing error.

CU9 will add a TUI sink to render the multi-agent dashboard; until then,
multi-agent runs use DumpSink (the same as single-agent), so users see a
per-agent narrative dump after the run completes.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@peyton-alt peyton-alt force-pushed the feat/entire-review-v2-a3 branch from 11df159 to cdb69ef Compare May 5, 2026 00:30
@peyton-alt peyton-alt force-pushed the feat/entire-review-v2-b1 branch from b423db9 to 97a72a1 Compare May 5, 2026 00:30
CU9 introduces TUISink, a Sink implementation that renders a per-agent
status dashboard during multi-agent review runs. Composed alongside
DumpSink in TTY mode; non-TTY multi-agent runs continue to use DumpSink
alone.

  - review/tui_sink.go: TUISink wraps a Bubble Tea program. AgentEvent
    translates each Event into a tea.Msg and sends it via Program.Send.
    RunFinished signals the model to render a final dashboard frame and
    waits for the user to dismiss with any key.
  - review/tui_model.go: reviewTUIModel handles agentEventMsg / tickMsg
    / WindowSizeMsg / KeyMsg. Per-row run-start timestamps stamped on
    first event from each agent (regression-prevented: PR #1018 used a
    single TUI-start timestamp that inflated late-starting agents'
    durations). Single cancel function: KeyCtrlC and out-of-TUI SIGINT
    both call the same context.CancelFunc, gated by sync.Once.
  - review/tui_detail.go: alt-screen drill-in. Ctrl+O enters; left/right
    cycles agents; up/down scrolls; Esc returns. detailView pads to
    termHeight so every frame returns the same line count (avoids ghost
    rows in the alt-screen frame diff). ANSI/CSI sequences stripped per
    line. Rune-safe truncation via stringutil.TruncateRunes.

Wires dispatch in cmd.go's runMultiAgentPath: TTY mode composes
[TUISink, DumpSink] (TUI for live dashboard, DumpSink for post-run
narrative); non-TTY composes [DumpSink] alone. tea.WithoutSignalHandler
keeps SIGINT routing on the cobra root's existing handler so the
single-cancel contract holds even when the TUI captures KeyCtrlC.

Anti-features explicitly NOT recreated:
- sync.Once-guarded onCancel + parallel signal.Notify goroutine: replaced
  by a single shared context.CancelFunc gated by one sync.Once on the model
- cancelMsg dead-code type: omitted entirely
- byte-slice truncation: stringutil.TruncateRunes throughout
- single TUI-start timestamp: per-row runStart stamped on first event
- missing alt-screen on drill-in: tea.EnterAltScreen on Ctrl+O
- variable-line-count detail render: detailView pads to termHeight

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@peyton-alt peyton-alt force-pushed the feat/entire-review-v2-b1 branch from 97a72a1 to ac94870 Compare May 5, 2026 03:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants