Skip to content

feat(web): add the Agents panel (4/5) - #4663

Open
shivamhwp wants to merge 3 commits into
subagent-obs/03-reusefrom
subagent-obs/04-agents-panel
Open

feat(web): add the Agents panel (4/5)#4663
shivamhwp wants to merge 3 commits into
subagent-obs/03-reusefrom
subagent-obs/04-agents-panel

Conversation

@shivamhwp

@shivamhwp shivamhwp commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Fourth of five stacked PRs replacing #4551. Stacked on #4662 — review that first.

Surfaces the subagent data the previous PRs record. A new right-panel tab lists every subagent on the thread with its role, model, status, token usage, recent activity, and the runs it has been activated for. Read-only — it renders what the projection already contains.

Grouping lives in client-runtime rather than the component so it stays testable: workflow coordinators own their phases, phase status derives from its members, and members orphaned by a missing coordinator fall back to the flat list rather than disappearing.

Coordinators are agents too

A workflow coordinator has its own model, usage and activations, and before its members are spawned it is the only row on the thread. So it renders as a card rather than a bare heading, and it is counted in the tallies — but only while it has no members, since afterwards they represent the same work and counting both double-reports it.

Without that, a thread running a workflow showed 0 active · 0 waiting · 0 settled with nothing listed, and unexplained tokens in the header.

Token accounting

Same rule: the total keeps whatever the members did not account for. Dropping the coordinator outright erased the entire workflow whenever a provider reported workflow usage while omitting per-agent tokens — the header then read "Usage unavailable" for a workflow that had spent thousands. Both fields are populated independently in the Claude adapter, so this is reachable, not theoretical.

Testing

Typecheck and lint clean. Web 1,500 passing, client-runtime 486 passing.

Verified in a browser against a real Codex subagent run: the tab renders the agent with its role and model badges, idle status, a real token count and run count, and an expandable "Activity and runs" section.

Reviewed by an independent agent pass; the token-collapse bug and the missing coordinator card both came out of it and are fixed here.

Note

The workflow path itself (phases, coordinators) is Claude-only — no other adapter emits kind: "workflow" — so that branch has unit coverage but has not been exercised against a live provider.


Note

Low Risk
Read-only UI over existing projection data with no auth or persistence changes; layout tweaks are localized to the right panel.

Overview
Adds a read-only Agents right-panel surface that lists orchestration V2 subagents from the thread projection—roles, models, status, token usage, runs, and recent activity.

deriveOrchestrationV2SubagentPanelState in client-runtime groups agents by workflow and phase, indexes activations, and aggregates tokens without double-counting coordinators when members report usage. Coordinators without members still count as active and render as cards (not bare headings); settled agents prefer result over stale progress.

ChatView lazy-loads AgentsPanelV2, opens the agents singleton via the tab bar + menu, and passes serverProjection. Right panel chrome moves maximize into the tab bar layoutControls instead of the main title bar when the panel is open.

Reviewed by Cursor Bugbot for commit b1bc757. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Add Agents panel to the right panel UI for orchestration V2 subagents

  • Adds AgentsPanelV2 component that groups subagents by workflow/phase, shows a coordinator card, per-member AgentCard components with collapsible activity/activations, and a header with total token usage and active/waiting/settled counts.
  • Adds deriveOrchestrationV2SubagentPanelState to derive structured panel state from raw subagent data, including phase ordering, activation indexing, and token aggregation that avoids double-counting workflow coordinators.
  • Registers 'agents' as a new singleton surface kind in rightPanelStore.ts and wires it into ChatView and RightPanelTabs so users can open the panel from the + menu or empty state.
  • Moves the right panel maximize control into the tab bar layout controls instead of the main title bar when the panel is open.

Macroscope summarized b1bc757.

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 974dd6ca-8529-4d41-828f-6336d20e5405

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch subagent-obs/04-agents-panel

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Jul 27, 2026
Comment thread apps/web/src/components/AgentsPanelV2.tsx Outdated
@shivamhwp
shivamhwp force-pushed the subagent-obs/04-agents-panel branch 2 times, most recently from c3a50f8 to 8c6a796 Compare July 27, 2026 20:52
@shivamhwp
shivamhwp force-pushed the subagent-obs/03-reuse branch from 5187d5b to cde2598 Compare July 27, 2026 23:03
@shivamhwp
shivamhwp force-pushed the subagent-obs/04-agents-panel branch from 8c6a796 to 103b937 Compare July 27, 2026 23:03
@shivamhwp
shivamhwp force-pushed the subagent-obs/03-reuse branch from cde2598 to fc5b293 Compare July 28, 2026 15:31
@shivamhwp
shivamhwp force-pushed the subagent-obs/04-agents-panel branch from 103b937 to 31adb36 Compare July 28, 2026 15:31
@shivamhwp
shivamhwp force-pushed the subagent-obs/03-reuse branch from fc5b293 to 85fe8a2 Compare July 28, 2026 19:27
@shivamhwp
shivamhwp force-pushed the subagent-obs/04-agents-panel branch from 31adb36 to b270c47 Compare July 28, 2026 19:27
Comment thread packages/client-runtime/src/state/orchestrationV2Subagents.ts Outdated
@shivamhwp
shivamhwp force-pushed the subagent-obs/03-reuse branch from 85fe8a2 to 795eb20 Compare July 28, 2026 19:46
@shivamhwp
shivamhwp force-pushed the subagent-obs/04-agents-panel branch from b270c47 to daf1a88 Compare July 28, 2026 19:46
@shivamhwp
shivamhwp force-pushed the subagent-obs/03-reuse branch from 795eb20 to 64bf642 Compare July 28, 2026 20:26
@shivamhwp
shivamhwp force-pushed the subagent-obs/04-agents-panel branch 2 times, most recently from 1dce464 to 4c169ed Compare July 29, 2026 01:19
@shivamhwp
shivamhwp force-pushed the subagent-obs/03-reuse branch from 32cbb3d to c63297e Compare July 29, 2026 01:24
@shivamhwp
shivamhwp force-pushed the subagent-obs/04-agents-panel branch 2 times, most recently from 70d5111 to c78d0ff Compare July 30, 2026 00:00
@shivamhwp
shivamhwp force-pushed the subagent-obs/03-reuse branch from c63297e to 4c70ab1 Compare July 30, 2026 00:00
shivamhwp and others added 2 commits July 30, 2026 06:14
Surfaces the subagent data the previous PRs record. A new right-panel
tab lists every subagent on the thread with its role, model, status,
token usage, recent activity, and the runs it has been activated for.

Grouping lives in client-runtime rather than the component so it stays
testable: workflow coordinators own their phases, phase status derives
from its members, and members orphaned by a missing coordinator fall
back to the flat list rather than disappearing.

A coordinator is an agent in its own right, so it renders as a card
rather than a bare heading — it has a model, usage and activations, and
before its members are spawned it is the only row on the thread. It is
counted in the tallies for the same reason, but only while it has no
members, since afterwards they represent the same work and counting both
double-reports it. Without that, a thread running a workflow showed
"0 active" with nothing listed and unexplained tokens in the header.

Usage follows the same rule: the total keeps whatever the members did
not account for. Dropping the coordinator outright erased the whole
workflow whenever a provider reported workflow usage but omitted
per-agent tokens, and the header read "Usage unavailable" for a workflow
that had spent thousands.

Read-only: this only renders what the projection already contains.
Co-Authored-By: Claude <noreply@anthropic.com>
@shivamhwp
shivamhwp force-pushed the subagent-obs/04-agents-panel branch from c78d0ff to a997806 Compare July 30, 2026 00:45
@shivamhwp
shivamhwp force-pushed the subagent-obs/03-reuse branch from 4c70ab1 to d453837 Compare July 30, 2026 00:45
@shivamhwp
shivamhwp marked this pull request as ready for review July 30, 2026 20:04
@macroscopeapp

macroscopeapp Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs human review

This PR introduces a new user-facing feature (Agents panel) with substantial new UI logic and state derivation code. New features with new components and non-trivial business logic warrant human review.

No code changes detected at b1bc757. Prior analysis still applies.

You can customize Macroscope's approvability policy. Learn more.

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

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 using high effort 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.

Reviewed by Cursor Bugbot for commit b1bc757. Configure here.

totalTokens:
reportedUsage.length === 0
? null
: reportedUsage.reduce((total, tokens) => total + tokens, 0),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Token total exceeds workflow usage

Medium Severity

When per-member usage.totalTokens sum to more than the workflow coordinator’s inclusive total, reportedUsage drops the coordinator contribution entirely but still adds each member’s full usage, so the Agents header can over-report tokens relative to the workflow aggregate the derivation assumes is authoritative.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit b1bc757. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant