feat(web): visualize workflows — agents panel, run cards, stop control (3/4) - #4663

Closed
shivamhwp wants to merge 8 commits into
subagent-obs/03-reusefrom
subagent-obs/04-agents-panel
Closed

feat(web): visualize workflows — agents panel, run cards, stop control (3/4)#4663
shivamhwp wants to merge 8 commits into
subagent-obs/03-reusefrom
subagent-obs/04-agents-panel

Conversation

@shivamhwp

@shivamhwpshivamhwp commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Third of four stacked PRs. Stacked on #4662 — review that first; this diff is against it.

The user-visible half of the series: everything needed to see and control subagents and workflows. This is the "Visualize subagents and workflows" item, and it deliberately ports the best UI ideas from #3650 onto the v2 data model per that PR's close-out.

What's here

The Agents panel. A right-panel tab listing every subagent on the thread — role, model, status, token usage, recent activity, activations per run. Grouping lives in client-runtime so it stays testable: workflow coordinators own their phases, phase status derives from members, members orphaned by a missing coordinator fall back to the flat list rather than disappearing. Coordinators render as cards and are counted without double-reporting member usage.

Inline workflow run cards. A workflow previously appeared as a bare subagent row per coordinator and per member. The coordinator's timeline item now renders as a run card: phase-grouped member rows with live status dots, settled/total rollup, token usage, and a Details button opening the Agents panel. Members of a present coordinator render inside the card only; orphaned members keep their own row. Remote runs render their session link (scheme-restricted to http/https at the adapter and re-checked at the render site). Live subagents ride a dedicated React context so progress-tick churn re-renders only subagent rows, not the whole virtualized timeline.

Workflow run handles. The Workflow tool's launch ACK carries the run's script path, transcript dir, and run id; the adapter attaches them to the coordinator's workflow struct (a merged partial — phases, name, and handles arrive from three different frames and none may clobber the others). Workflow tool_uses now skip toolCalls like Agent ones do, so the run is represented once. These handles are the prerequisite for script view / transcript / resume affordances later.

Stop control. A new subagent.stop command through the durable command path: the decider validates the subagent is active, records "Stop requested" on its row, and queues a process-bound subagent.stop effect; the effect worker resolves the session and calls the adapter's task stop — for Claude, the SDK runtime's undocumented stopTask, read behind the same single-cast convention as workflow_progress. The provider's own task_notification remains the only terminalizer. A released session is treated as already stopped; a runtime without task-level stop fails the effect loudly; recovery cancels pending stop effects after process loss like the other session-scoped effects.

Verified against a live provider

A scripted browser pass against a real Claude session (screenshots on file):

  • The run card appeared with phases and live agent rows; completed at 2/2 agents · 32.7k tok; no duplicate member rows; no Workflow tool-call row; Details opened the panel; state survived a page reload.
  • Stop worked end to end: a 36-agent workflow flipped to Stopped within ~8s of the click; the protocol log shows the outgoing task.stop frame and the SDK's "status":"stopped" notifications coming back.
  • Live testing also caught a real bug, fixed in the last commit: the SDK reports agent attempt 1-based, and the adapter's 0-based assumption stamped every first-attempt agent with a spurious "retry 2" badge.

One observation for the record: after a stop, the parent Claude turn can keep running for minutes (the SDK's turn appears to wait on its dead background task). Our layer settles correctly; this is the known "provider accepts interrupt but never terminalizes" family in the interrupt-hardening TODO, not addressed here.

Testing

Typecheck and lint clean. Web 1,724 passing, client-runtime 539, server orchestration-v2 suite 575. New: run-card component tests, panel derivation tests, stopTask turn-control tests (live/released/unsupported session), extended claude_workflow replay fixture including a hostile javascript: sessionUrl pinned as dropped.


Note

Medium Risk
Touches orchestration command/effect paths and relies on an undocumented Claude SDK stopTask; UI and projection changes are broad but bounded, with explicit failure modes when stop is unsupported or sessions are gone.

Overview
User-facing: A new Agents right-panel tab groups subagents by workflow phase (coordinator cards, member rows, usage and activity). Workflow coordinators in the chat timeline render as inline run cards (phases, member status, Stop/Details) instead of duplicate subagent rows; live subagent projection uses a dedicated context so progress ticks do not re-render the whole timeline.

Stop path:subagent.stop runs through contracts → orchestrator (validates active subagent, emits “Stop requested”, queues effect) → effect worker → ProviderTurnControlService.stopTask → optional adapter stopTask. Claude calls the SDK runtime’s undocumented stopTask by native task id; released sessions are treated as already stopped; missing support fails the effect. Session routing prefers the run’s provider session, then the active thread.

Claude adapter: Workflow run handles (name, runId, scriptPath, transcriptDir, sessionUrl) merge into coordinator workflow without clobbering phases from progress frames; Workflow tool_uses skip toolCalls like Agent; workflow agent attempt is clamped to 1-based SDK reporting; sessionUrl is restricted to http(s) at ingestion.

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

Note

Add agents panel, workflow run cards, and subagent stop control to the chat UI

  • Adds a new AgentsPanelV2 right-panel surface that groups active subagents by workflow phase, shows coordinator cards with token usage and status, and renders direct agents; accessible via a new 'Agents' tab in RightPanelTabs.
  • Introduces WorkflowRunCardV2, an inline timeline card per workflow coordinator showing phase/member rows (capped at 8 with urgency-first ordering), aggregate token usage, run status, and a Stop button.
  • Implements end-to-end subagent stop: new subagent.stop command propagates from client runtime → contracts → orchestrator → EffectWorkerProviderTurnControlServiceClaudeAdapterV2.stopTask.
  • Extends OrchestrationV2Subagent to carry optional workflow run-handle fields (name, runId, scriptPath, transcriptDir, sessionUrl, warning); the Claude adapter extracts these from tool results while deferring settlement to task notifications.
  • Adds state-derivation helpers in orchestrationV2Subagents.ts (deriveOrchestrationV2SubagentPanelState, deriveOrchestrationV2WorkflowRunCard, orchestrationV2WorkflowMemberIds, formatSubagentTokenCount) backed by unit tests.
  • Risk: ClaudeAdapterV2 now calls an undocumented stopTask on the underlying SDK query runtime via a cast; if the SDK does not expose it, the stop fails with a ClaudeAgentSdkQueryRunnerError.

Macroscope summarized 27ecbe1.

Review-fix verification (2026-08-01)

  • c9d6a7c8a makes coordinator usage authoritative, makes Claude stop-without-live-query a warning/no-op, and restricts stop routing to the run-owned or explicitly active provider session.
  • Focused client/server tests pass, including coordinator totals larger than member totals and three provider-session routing cases.
  • Chrome verified the Codex Agents surface, settled counts, per-child usage, aggregate usage, and ordinary-command distinction.

Codex Agents panel

The fresh Claude workflow/Stop rerun could not reach a workflow card because the local Claude OAuth session had expired. The failure was surfaced visibly; current live Stop evidence is therefore blocked rather than claimed.

Claude provider blocker
\n### Final Effect review follow-up (2026-08-01)\n\n- 76a62c7 models the missing Claude stopTask capability as a direct typed failure and reuses an exported ProviderTaskStopError predicate.\n- Focused Claude adapter and provider turn-control tests pass: 52/52. Formatting is clean and the server typecheck exits successfully.\n\n### CI runner note (2026-08-01)\n\n- Test, mobile analysis, release smoke, Macroscope Effect, Macroscope correctness, and Bugbot pass on 76a62c7.\n- The Check job was retried twice after its initial failure. All three attempts reported all 2,639 files formatted, then Vite+ panicked while writing existing lint warnings to stdout with OS error 11 (resource temporarily unavailable).\n- The top stacked branch in #4664 contains this commit and has green Check and Test jobs. This is an external runner blocker, not a source diagnostic.\n

@coderabbitai

coderabbitaiBot 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: c6ee3086-b988-4b25-aced-c299a90e62f1

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-actionsgithub-actionsBot 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 threadapps/web/src/components/AgentsPanelV2.tsx Outdated
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch 2 times, most recently from c3a50f8 to 8c6a796CompareJuly 27, 2026 20:52
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from 5187d5b to cde2598CompareJuly 27, 2026 23:03
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch from 8c6a796 to 103b937CompareJuly 27, 2026 23:03
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from cde2598 to fc5b293CompareJuly 28, 2026 15:31
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch from 103b937 to 31adb36CompareJuly 28, 2026 15:31
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from fc5b293 to 85fe8a2CompareJuly 28, 2026 19:27
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch from 31adb36 to b270c47CompareJuly 28, 2026 19:27
Comment threadpackages/client-runtime/src/state/orchestrationV2Subagents.ts Outdated
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from 85fe8a2 to 795eb20CompareJuly 28, 2026 19:46
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch from b270c47 to daf1a88CompareJuly 28, 2026 19:46
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from 795eb20 to 64bf642CompareJuly 28, 2026 20:26
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch 2 times, most recently from 1dce464 to 4c169edCompareJuly 29, 2026 01:19
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from 32cbb3d to c63297eCompareJuly 29, 2026 01:24
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch 2 times, most recently from 70d5111 to c78d0ffCompareJuly 30, 2026 00:00
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from c63297e to 4c70ab1CompareJuly 30, 2026 00:00
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch from c78d0ff to a997806CompareJuly 30, 2026 00:45
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from 4c70ab1 to d453837CompareJuly 30, 2026 00:45
@shivamhwp
shivamhwp marked this pull request as ready for review July 30, 2026 20:04
@macroscopeapp

macroscopeappBot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs human review

New feature introducing workflow visualization panel, inline run cards, and stop controls across server orchestration and web UI layers. The scope includes new components, a new command type (subagent.stop), and contract schema additions - warranting human review for a feature of this breadth.

No code changes detected at 27ecbe1. Prior analysis still applies.

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

@github-actionsgithub-actionsBot added size:XXL 1,000+ changed lines (additions + deletions). and removed size:L 100-499 changed lines (additions + deletions). labels Aug 1, 2026
@shivamhwpshivamhwp changed the title feat(web): add the Agents panel (4/5)feat(web): visualize workflows — agents panel, run cards, stop control (3/4)Aug 1, 2026
Comment threadapps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts
Comment threadapps/server/src/orchestration-v2/Orchestrator.ts Outdated

@macroscopeappmacroscopeappBot 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.

Effect service conventions review of the new stopTask surface (adapter runtime, ProviderTurnControlServiceV2, worker effect). Two findings, both in the error-modelling rules; the rest of the touched Effect code (namespace imports, layer/dependency acquisition, Layer.succeed only in test seams, no ManagedRuntime/runPromise outside boundaries) looks consistent with the conventions.

Posted via Macroscope — Effect Service Conventions

Comment threadapps/server/src/orchestration-v2/ProviderTurnControlService.ts Outdated
Comment threadapps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts Outdated

@cursorcursorBot 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 3 potential issues.

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 c9d6a7c. Configure here.

Comment threadapps/server/src/orchestration-v2/Orchestrator.ts
Comment threadapps/web/src/components/WorkflowRunCardV2.tsx
@shivamhwp

shivamhwp commented Aug 1, 2026

Copy link
Copy Markdown
CollaboratorAuthor

CI follow-up (2026-08-01): all code-bearing checks pass, including Test, Mobile Native Static Analysis, Release Smoke, Macroscope Effect Service Conventions, Macroscope Correctness, and Cursor Bugbot. The Check job was retried twice after its initial failure and hit the same Vite+ runner panic on all three attempts: failed printing to stdout: Resource temporarily unavailable (os error 11). Each attempt reported all 2,639 files correctly formatted before the panic. The top stacked branch at #4664, which contains this exact commit, has a green Check and Test. No source failure is being hidden here; this is recorded as an external CI runner blocker.

— Codex on behalf of shivamhwp

shivamhwpand others added 8 commits August 4, 2026 01:08
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>
The Workflow tool result is the run's only carrier of its disk handles
(script path, transcript dir, run id) and remote session URL. Attach them
to the coordinator's workflow struct so script view, transcripts, and
resume-command affordances have something to read.
The workflow input on updateClaudeSubagentNode becomes a merged partial:
phases arrive on progress snapshots, the name on task_started, and
handles on the tool result, so no writer may clobber the others.
Workflow tool_uses now skip toolCalls like Agent ones do — the
coordinator subagent row is the run's timeline representation, and
registering the tool call too would double-render it. The launch ACK
consequently routes through the subagent branch, which must not
terminalize the coordinator (only task_notification does).
sessionUrl is scheme-restricted to http(s) at the adapter; the replay
fixture carries a hostile javascript: URL to pin the filter.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A workflow previously appeared in the timeline as a bare subagent row per
coordinator and per member — no phases, no live status, and each member
double-reported as its own row. The coordinator's subagent item now
renders as a run card: phase-grouped member rows with live status dots,
a settled/total rollup, token usage, and a Details button that opens the
Agents panel. Members of a present coordinator render nothing (the card
already shows them); members orphaned by a missing coordinator keep
their row rather than disappearing.
Remote runs render their session link instead of member rows, re-checked
against the http(s) allowlist as defense in depth for payloads persisted
before the adapter-side filter. Rows cap at 8, keeping running and
failed agents plus the most recently updated; the remainder defers to
the Agents panel.
Live subagents ride a dedicated context rather than TimelineRowCtx so
progress-tick churn re-renders only subagent rows, not the whole list.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A running workflow previously could only be abandoned by interrupting
the whole run. A new subagent.stop command flows through the durable
command path: the decider validates the subagent is active and carries a
native task ref, records the user's intent as a Stop requested activity
on the subagent row, and queues a process-bound subagent.stop effect.
The effect worker resolves the session and calls the adapter's task stop
— for Claude, the SDK runtime's undocumented stopTask, read behind the
same single-cast convention as workflow_progress.
The provider's own task_notification remains the only terminalizer; the
command records intent, it does not fake a terminal state. A released
session is treated as already stopped (nothing can still be running
under it), while a runtime without task-level stop fails the effect
loudly. Stop effects are process-bound, so recovery cancels them after
process loss like the other session-scoped effects.
The web run card shows Stop only while the coordinator is active, wired
through thread environment commands as thread:stop-subagent.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… retries
Live testing showed every workflow agent wearing a "retry 2" badge on
its first attempt: the SDK reports attempt 1-based once an agent starts,
and the adapter added 1 on top assuming 0-based. Clamp absent or 0 up
to 1 instead of incrementing.
Found by a computer-use pass against a real workflow run; the replay
fixture's hand-authored attempt: 0 normalizes to the same 1 as before.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from b0398e1 to e151f62CompareAugust 3, 2026 19:44
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch from 76a62c7 to 27ecbe1CompareAugust 3, 2026 19:44
@shivamhwp

Copy link
Copy Markdown
CollaboratorAuthor

Converged into #4664, which now carries the full series against the orchestrator-v2 base — the commit history there preserves this PR's slice, and this PR's review record (findings and fix replies) remains the reference for it.

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

Labels

size:XXL1,000+ changed lines (additions + deletions).vouch:trustedPR 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

@shivamhwp
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

feat(web): visualize workflows — agents panel, run cards, stop control (3/4) - #4663

Closed
shivamhwp wants to merge 8 commits into
subagent-obs/03-reusefrom
subagent-obs/04-agents-panel
Closed

feat(web): visualize workflows — agents panel, run cards, stop control (3/4)#4663
shivamhwp wants to merge 8 commits into
subagent-obs/03-reusefrom
subagent-obs/04-agents-panel

Conversation

@shivamhwp

@shivamhwpshivamhwp commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Third of four stacked PRs. Stacked on #4662 — review that first; this diff is against it.

The user-visible half of the series: everything needed to see and control subagents and workflows. This is the "Visualize subagents and workflows" item, and it deliberately ports the best UI ideas from #3650 onto the v2 data model per that PR's close-out.

What's here

The Agents panel. A right-panel tab listing every subagent on the thread — role, model, status, token usage, recent activity, activations per run. Grouping lives in client-runtime so it stays testable: workflow coordinators own their phases, phase status derives from members, members orphaned by a missing coordinator fall back to the flat list rather than disappearing. Coordinators render as cards and are counted without double-reporting member usage.

Inline workflow run cards. A workflow previously appeared as a bare subagent row per coordinator and per member. The coordinator's timeline item now renders as a run card: phase-grouped member rows with live status dots, settled/total rollup, token usage, and a Details button opening the Agents panel. Members of a present coordinator render inside the card only; orphaned members keep their own row. Remote runs render their session link (scheme-restricted to http/https at the adapter and re-checked at the render site). Live subagents ride a dedicated React context so progress-tick churn re-renders only subagent rows, not the whole virtualized timeline.

Workflow run handles. The Workflow tool's launch ACK carries the run's script path, transcript dir, and run id; the adapter attaches them to the coordinator's workflow struct (a merged partial — phases, name, and handles arrive from three different frames and none may clobber the others). Workflow tool_uses now skip toolCalls like Agent ones do, so the run is represented once. These handles are the prerequisite for script view / transcript / resume affordances later.

Stop control. A new subagent.stop command through the durable command path: the decider validates the subagent is active, records "Stop requested" on its row, and queues a process-bound subagent.stop effect; the effect worker resolves the session and calls the adapter's task stop — for Claude, the SDK runtime's undocumented stopTask, read behind the same single-cast convention as workflow_progress. The provider's own task_notification remains the only terminalizer. A released session is treated as already stopped; a runtime without task-level stop fails the effect loudly; recovery cancels pending stop effects after process loss like the other session-scoped effects.

Verified against a live provider

A scripted browser pass against a real Claude session (screenshots on file):

  • The run card appeared with phases and live agent rows; completed at 2/2 agents · 32.7k tok; no duplicate member rows; no Workflow tool-call row; Details opened the panel; state survived a page reload.
  • Stop worked end to end: a 36-agent workflow flipped to Stopped within ~8s of the click; the protocol log shows the outgoing task.stop frame and the SDK's "status":"stopped" notifications coming back.
  • Live testing also caught a real bug, fixed in the last commit: the SDK reports agent attempt 1-based, and the adapter's 0-based assumption stamped every first-attempt agent with a spurious "retry 2" badge.

One observation for the record: after a stop, the parent Claude turn can keep running for minutes (the SDK's turn appears to wait on its dead background task). Our layer settles correctly; this is the known "provider accepts interrupt but never terminalizes" family in the interrupt-hardening TODO, not addressed here.

Testing

Typecheck and lint clean. Web 1,724 passing, client-runtime 539, server orchestration-v2 suite 575. New: run-card component tests, panel derivation tests, stopTask turn-control tests (live/released/unsupported session), extended claude_workflow replay fixture including a hostile javascript: sessionUrl pinned as dropped.


Note

Medium Risk
Touches orchestration command/effect paths and relies on an undocumented Claude SDK stopTask; UI and projection changes are broad but bounded, with explicit failure modes when stop is unsupported or sessions are gone.

Overview
User-facing: A new Agents right-panel tab groups subagents by workflow phase (coordinator cards, member rows, usage and activity). Workflow coordinators in the chat timeline render as inline run cards (phases, member status, Stop/Details) instead of duplicate subagent rows; live subagent projection uses a dedicated context so progress ticks do not re-render the whole timeline.

Stop path:subagent.stop runs through contracts → orchestrator (validates active subagent, emits “Stop requested”, queues effect) → effect worker → ProviderTurnControlService.stopTask → optional adapter stopTask. Claude calls the SDK runtime’s undocumented stopTask by native task id; released sessions are treated as already stopped; missing support fails the effect. Session routing prefers the run’s provider session, then the active thread.

Claude adapter: Workflow run handles (name, runId, scriptPath, transcriptDir, sessionUrl) merge into coordinator workflow without clobbering phases from progress frames; Workflow tool_uses skip toolCalls like Agent; workflow agent attempt is clamped to 1-based SDK reporting; sessionUrl is restricted to http(s) at ingestion.

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

Note

Add agents panel, workflow run cards, and subagent stop control to the chat UI

  • Adds a new AgentsPanelV2 right-panel surface that groups active subagents by workflow phase, shows coordinator cards with token usage and status, and renders direct agents; accessible via a new 'Agents' tab in RightPanelTabs.
  • Introduces WorkflowRunCardV2, an inline timeline card per workflow coordinator showing phase/member rows (capped at 8 with urgency-first ordering), aggregate token usage, run status, and a Stop button.
  • Implements end-to-end subagent stop: new subagent.stop command propagates from client runtime → contracts → orchestrator → EffectWorkerProviderTurnControlServiceClaudeAdapterV2.stopTask.
  • Extends OrchestrationV2Subagent to carry optional workflow run-handle fields (name, runId, scriptPath, transcriptDir, sessionUrl, warning); the Claude adapter extracts these from tool results while deferring settlement to task notifications.
  • Adds state-derivation helpers in orchestrationV2Subagents.ts (deriveOrchestrationV2SubagentPanelState, deriveOrchestrationV2WorkflowRunCard, orchestrationV2WorkflowMemberIds, formatSubagentTokenCount) backed by unit tests.
  • Risk: ClaudeAdapterV2 now calls an undocumented stopTask on the underlying SDK query runtime via a cast; if the SDK does not expose it, the stop fails with a ClaudeAgentSdkQueryRunnerError.

Macroscope summarized 27ecbe1.

Review-fix verification (2026-08-01)

  • c9d6a7c8a makes coordinator usage authoritative, makes Claude stop-without-live-query a warning/no-op, and restricts stop routing to the run-owned or explicitly active provider session.
  • Focused client/server tests pass, including coordinator totals larger than member totals and three provider-session routing cases.
  • Chrome verified the Codex Agents surface, settled counts, per-child usage, aggregate usage, and ordinary-command distinction.

Codex Agents panel

The fresh Claude workflow/Stop rerun could not reach a workflow card because the local Claude OAuth session had expired. The failure was surfaced visibly; current live Stop evidence is therefore blocked rather than claimed.

Claude provider blocker
\n### Final Effect review follow-up (2026-08-01)\n\n- 76a62c7 models the missing Claude stopTask capability as a direct typed failure and reuses an exported ProviderTaskStopError predicate.\n- Focused Claude adapter and provider turn-control tests pass: 52/52. Formatting is clean and the server typecheck exits successfully.\n\n### CI runner note (2026-08-01)\n\n- Test, mobile analysis, release smoke, Macroscope Effect, Macroscope correctness, and Bugbot pass on 76a62c7.\n- The Check job was retried twice after its initial failure. All three attempts reported all 2,639 files formatted, then Vite+ panicked while writing existing lint warnings to stdout with OS error 11 (resource temporarily unavailable).\n- The top stacked branch in #4664 contains this commit and has green Check and Test jobs. This is an external runner blocker, not a source diagnostic.\n

@coderabbitai

coderabbitaiBot 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: c6ee3086-b988-4b25-aced-c299a90e62f1

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-actionsgithub-actionsBot 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 threadapps/web/src/components/AgentsPanelV2.tsx Outdated
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch 2 times, most recently from c3a50f8 to 8c6a796CompareJuly 27, 2026 20:52
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from 5187d5b to cde2598CompareJuly 27, 2026 23:03
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch from 8c6a796 to 103b937CompareJuly 27, 2026 23:03
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from cde2598 to fc5b293CompareJuly 28, 2026 15:31
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch from 103b937 to 31adb36CompareJuly 28, 2026 15:31
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from fc5b293 to 85fe8a2CompareJuly 28, 2026 19:27
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch from 31adb36 to b270c47CompareJuly 28, 2026 19:27
Comment threadpackages/client-runtime/src/state/orchestrationV2Subagents.ts Outdated
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from 85fe8a2 to 795eb20CompareJuly 28, 2026 19:46
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch from b270c47 to daf1a88CompareJuly 28, 2026 19:46
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from 795eb20 to 64bf642CompareJuly 28, 2026 20:26
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch 2 times, most recently from 1dce464 to 4c169edCompareJuly 29, 2026 01:19
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from 32cbb3d to c63297eCompareJuly 29, 2026 01:24
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch 2 times, most recently from 70d5111 to c78d0ffCompareJuly 30, 2026 00:00
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from c63297e to 4c70ab1CompareJuly 30, 2026 00:00
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch from c78d0ff to a997806CompareJuly 30, 2026 00:45
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from 4c70ab1 to d453837CompareJuly 30, 2026 00:45
@shivamhwp
shivamhwp marked this pull request as ready for review July 30, 2026 20:04
@macroscopeapp

macroscopeappBot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs human review

New feature introducing workflow visualization panel, inline run cards, and stop controls across server orchestration and web UI layers. The scope includes new components, a new command type (subagent.stop), and contract schema additions - warranting human review for a feature of this breadth.

No code changes detected at 27ecbe1. Prior analysis still applies.

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

@github-actionsgithub-actionsBot added size:XXL 1,000+ changed lines (additions + deletions). and removed size:L 100-499 changed lines (additions + deletions). labels Aug 1, 2026
@shivamhwpshivamhwp changed the title feat(web): add the Agents panel (4/5)feat(web): visualize workflows — agents panel, run cards, stop control (3/4)Aug 1, 2026
Comment threadapps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts
Comment threadapps/server/src/orchestration-v2/Orchestrator.ts Outdated

@macroscopeappmacroscopeappBot 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.

Effect service conventions review of the new stopTask surface (adapter runtime, ProviderTurnControlServiceV2, worker effect). Two findings, both in the error-modelling rules; the rest of the touched Effect code (namespace imports, layer/dependency acquisition, Layer.succeed only in test seams, no ManagedRuntime/runPromise outside boundaries) looks consistent with the conventions.

Posted via Macroscope — Effect Service Conventions

Comment threadapps/server/src/orchestration-v2/ProviderTurnControlService.ts Outdated
Comment threadapps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts Outdated

@cursorcursorBot 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 3 potential issues.

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 c9d6a7c. Configure here.

Comment threadapps/server/src/orchestration-v2/Orchestrator.ts
Comment threadapps/web/src/components/WorkflowRunCardV2.tsx
@shivamhwp

shivamhwp commented Aug 1, 2026

Copy link
Copy Markdown
CollaboratorAuthor

CI follow-up (2026-08-01): all code-bearing checks pass, including Test, Mobile Native Static Analysis, Release Smoke, Macroscope Effect Service Conventions, Macroscope Correctness, and Cursor Bugbot. The Check job was retried twice after its initial failure and hit the same Vite+ runner panic on all three attempts: failed printing to stdout: Resource temporarily unavailable (os error 11). Each attempt reported all 2,639 files correctly formatted before the panic. The top stacked branch at #4664, which contains this exact commit, has a green Check and Test. No source failure is being hidden here; this is recorded as an external CI runner blocker.

— Codex on behalf of shivamhwp

shivamhwpand others added 8 commits August 4, 2026 01:08
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>
The Workflow tool result is the run's only carrier of its disk handles
(script path, transcript dir, run id) and remote session URL. Attach them
to the coordinator's workflow struct so script view, transcripts, and
resume-command affordances have something to read.
The workflow input on updateClaudeSubagentNode becomes a merged partial:
phases arrive on progress snapshots, the name on task_started, and
handles on the tool result, so no writer may clobber the others.
Workflow tool_uses now skip toolCalls like Agent ones do — the
coordinator subagent row is the run's timeline representation, and
registering the tool call too would double-render it. The launch ACK
consequently routes through the subagent branch, which must not
terminalize the coordinator (only task_notification does).
sessionUrl is scheme-restricted to http(s) at the adapter; the replay
fixture carries a hostile javascript: URL to pin the filter.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A workflow previously appeared in the timeline as a bare subagent row per
coordinator and per member — no phases, no live status, and each member
double-reported as its own row. The coordinator's subagent item now
renders as a run card: phase-grouped member rows with live status dots,
a settled/total rollup, token usage, and a Details button that opens the
Agents panel. Members of a present coordinator render nothing (the card
already shows them); members orphaned by a missing coordinator keep
their row rather than disappearing.
Remote runs render their session link instead of member rows, re-checked
against the http(s) allowlist as defense in depth for payloads persisted
before the adapter-side filter. Rows cap at 8, keeping running and
failed agents plus the most recently updated; the remainder defers to
the Agents panel.
Live subagents ride a dedicated context rather than TimelineRowCtx so
progress-tick churn re-renders only subagent rows, not the whole list.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A running workflow previously could only be abandoned by interrupting
the whole run. A new subagent.stop command flows through the durable
command path: the decider validates the subagent is active and carries a
native task ref, records the user's intent as a Stop requested activity
on the subagent row, and queues a process-bound subagent.stop effect.
The effect worker resolves the session and calls the adapter's task stop
— for Claude, the SDK runtime's undocumented stopTask, read behind the
same single-cast convention as workflow_progress.
The provider's own task_notification remains the only terminalizer; the
command records intent, it does not fake a terminal state. A released
session is treated as already stopped (nothing can still be running
under it), while a runtime without task-level stop fails the effect
loudly. Stop effects are process-bound, so recovery cancels them after
process loss like the other session-scoped effects.
The web run card shows Stop only while the coordinator is active, wired
through thread environment commands as thread:stop-subagent.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… retries
Live testing showed every workflow agent wearing a "retry 2" badge on
its first attempt: the SDK reports attempt 1-based once an agent starts,
and the adapter added 1 on top assuming 0-based. Clamp absent or 0 up
to 1 instead of incrementing.
Found by a computer-use pass against a real workflow run; the replay
fixture's hand-authored attempt: 0 normalizes to the same 1 as before.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from b0398e1 to e151f62CompareAugust 3, 2026 19:44
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch from 76a62c7 to 27ecbe1CompareAugust 3, 2026 19:44
@shivamhwp

Copy link
Copy Markdown
CollaboratorAuthor

Converged into #4664, which now carries the full series against the orchestrator-v2 base — the commit history there preserves this PR's slice, and this PR's review record (findings and fix replies) remains the reference for it.

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

Labels

size:XXL1,000+ changed lines (additions + deletions).vouch:trustedPR 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

@shivamhwp
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

feat(web): visualize workflows — agents panel, run cards, stop control (3/4) - #4663

Closed
shivamhwp wants to merge 8 commits into
subagent-obs/03-reusefrom
subagent-obs/04-agents-panel
Closed

feat(web): visualize workflows — agents panel, run cards, stop control (3/4)#4663
shivamhwp wants to merge 8 commits into
subagent-obs/03-reusefrom
subagent-obs/04-agents-panel

Conversation

@shivamhwp

@shivamhwpshivamhwp commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Third of four stacked PRs. Stacked on #4662 — review that first; this diff is against it.

The user-visible half of the series: everything needed to see and control subagents and workflows. This is the "Visualize subagents and workflows" item, and it deliberately ports the best UI ideas from #3650 onto the v2 data model per that PR's close-out.

What's here

The Agents panel. A right-panel tab listing every subagent on the thread — role, model, status, token usage, recent activity, activations per run. Grouping lives in client-runtime so it stays testable: workflow coordinators own their phases, phase status derives from members, members orphaned by a missing coordinator fall back to the flat list rather than disappearing. Coordinators render as cards and are counted without double-reporting member usage.

Inline workflow run cards. A workflow previously appeared as a bare subagent row per coordinator and per member. The coordinator's timeline item now renders as a run card: phase-grouped member rows with live status dots, settled/total rollup, token usage, and a Details button opening the Agents panel. Members of a present coordinator render inside the card only; orphaned members keep their own row. Remote runs render their session link (scheme-restricted to http/https at the adapter and re-checked at the render site). Live subagents ride a dedicated React context so progress-tick churn re-renders only subagent rows, not the whole virtualized timeline.

Workflow run handles. The Workflow tool's launch ACK carries the run's script path, transcript dir, and run id; the adapter attaches them to the coordinator's workflow struct (a merged partial — phases, name, and handles arrive from three different frames and none may clobber the others). Workflow tool_uses now skip toolCalls like Agent ones do, so the run is represented once. These handles are the prerequisite for script view / transcript / resume affordances later.

Stop control. A new subagent.stop command through the durable command path: the decider validates the subagent is active, records "Stop requested" on its row, and queues a process-bound subagent.stop effect; the effect worker resolves the session and calls the adapter's task stop — for Claude, the SDK runtime's undocumented stopTask, read behind the same single-cast convention as workflow_progress. The provider's own task_notification remains the only terminalizer. A released session is treated as already stopped; a runtime without task-level stop fails the effect loudly; recovery cancels pending stop effects after process loss like the other session-scoped effects.

Verified against a live provider

A scripted browser pass against a real Claude session (screenshots on file):

  • The run card appeared with phases and live agent rows; completed at 2/2 agents · 32.7k tok; no duplicate member rows; no Workflow tool-call row; Details opened the panel; state survived a page reload.
  • Stop worked end to end: a 36-agent workflow flipped to Stopped within ~8s of the click; the protocol log shows the outgoing task.stop frame and the SDK's "status":"stopped" notifications coming back.
  • Live testing also caught a real bug, fixed in the last commit: the SDK reports agent attempt 1-based, and the adapter's 0-based assumption stamped every first-attempt agent with a spurious "retry 2" badge.

One observation for the record: after a stop, the parent Claude turn can keep running for minutes (the SDK's turn appears to wait on its dead background task). Our layer settles correctly; this is the known "provider accepts interrupt but never terminalizes" family in the interrupt-hardening TODO, not addressed here.

Testing

Typecheck and lint clean. Web 1,724 passing, client-runtime 539, server orchestration-v2 suite 575. New: run-card component tests, panel derivation tests, stopTask turn-control tests (live/released/unsupported session), extended claude_workflow replay fixture including a hostile javascript: sessionUrl pinned as dropped.


Note

Medium Risk
Touches orchestration command/effect paths and relies on an undocumented Claude SDK stopTask; UI and projection changes are broad but bounded, with explicit failure modes when stop is unsupported or sessions are gone.

Overview
User-facing: A new Agents right-panel tab groups subagents by workflow phase (coordinator cards, member rows, usage and activity). Workflow coordinators in the chat timeline render as inline run cards (phases, member status, Stop/Details) instead of duplicate subagent rows; live subagent projection uses a dedicated context so progress ticks do not re-render the whole timeline.

Stop path:subagent.stop runs through contracts → orchestrator (validates active subagent, emits “Stop requested”, queues effect) → effect worker → ProviderTurnControlService.stopTask → optional adapter stopTask. Claude calls the SDK runtime’s undocumented stopTask by native task id; released sessions are treated as already stopped; missing support fails the effect. Session routing prefers the run’s provider session, then the active thread.

Claude adapter: Workflow run handles (name, runId, scriptPath, transcriptDir, sessionUrl) merge into coordinator workflow without clobbering phases from progress frames; Workflow tool_uses skip toolCalls like Agent; workflow agent attempt is clamped to 1-based SDK reporting; sessionUrl is restricted to http(s) at ingestion.

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

Note

Add agents panel, workflow run cards, and subagent stop control to the chat UI

  • Adds a new AgentsPanelV2 right-panel surface that groups active subagents by workflow phase, shows coordinator cards with token usage and status, and renders direct agents; accessible via a new 'Agents' tab in RightPanelTabs.
  • Introduces WorkflowRunCardV2, an inline timeline card per workflow coordinator showing phase/member rows (capped at 8 with urgency-first ordering), aggregate token usage, run status, and a Stop button.
  • Implements end-to-end subagent stop: new subagent.stop command propagates from client runtime → contracts → orchestrator → EffectWorkerProviderTurnControlServiceClaudeAdapterV2.stopTask.
  • Extends OrchestrationV2Subagent to carry optional workflow run-handle fields (name, runId, scriptPath, transcriptDir, sessionUrl, warning); the Claude adapter extracts these from tool results while deferring settlement to task notifications.
  • Adds state-derivation helpers in orchestrationV2Subagents.ts (deriveOrchestrationV2SubagentPanelState, deriveOrchestrationV2WorkflowRunCard, orchestrationV2WorkflowMemberIds, formatSubagentTokenCount) backed by unit tests.
  • Risk: ClaudeAdapterV2 now calls an undocumented stopTask on the underlying SDK query runtime via a cast; if the SDK does not expose it, the stop fails with a ClaudeAgentSdkQueryRunnerError.

Macroscope summarized 27ecbe1.

Review-fix verification (2026-08-01)

  • c9d6a7c8a makes coordinator usage authoritative, makes Claude stop-without-live-query a warning/no-op, and restricts stop routing to the run-owned or explicitly active provider session.
  • Focused client/server tests pass, including coordinator totals larger than member totals and three provider-session routing cases.
  • Chrome verified the Codex Agents surface, settled counts, per-child usage, aggregate usage, and ordinary-command distinction.

Codex Agents panel

The fresh Claude workflow/Stop rerun could not reach a workflow card because the local Claude OAuth session had expired. The failure was surfaced visibly; current live Stop evidence is therefore blocked rather than claimed.

Claude provider blocker
\n### Final Effect review follow-up (2026-08-01)\n\n- 76a62c7 models the missing Claude stopTask capability as a direct typed failure and reuses an exported ProviderTaskStopError predicate.\n- Focused Claude adapter and provider turn-control tests pass: 52/52. Formatting is clean and the server typecheck exits successfully.\n\n### CI runner note (2026-08-01)\n\n- Test, mobile analysis, release smoke, Macroscope Effect, Macroscope correctness, and Bugbot pass on 76a62c7.\n- The Check job was retried twice after its initial failure. All three attempts reported all 2,639 files formatted, then Vite+ panicked while writing existing lint warnings to stdout with OS error 11 (resource temporarily unavailable).\n- The top stacked branch in #4664 contains this commit and has green Check and Test jobs. This is an external runner blocker, not a source diagnostic.\n

@coderabbitai

coderabbitaiBot 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: c6ee3086-b988-4b25-aced-c299a90e62f1

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-actionsgithub-actionsBot 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 threadapps/web/src/components/AgentsPanelV2.tsx Outdated
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch 2 times, most recently from c3a50f8 to 8c6a796CompareJuly 27, 2026 20:52
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from 5187d5b to cde2598CompareJuly 27, 2026 23:03
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch from 8c6a796 to 103b937CompareJuly 27, 2026 23:03
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from cde2598 to fc5b293CompareJuly 28, 2026 15:31
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch from 103b937 to 31adb36CompareJuly 28, 2026 15:31
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from fc5b293 to 85fe8a2CompareJuly 28, 2026 19:27
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch from 31adb36 to b270c47CompareJuly 28, 2026 19:27
Comment threadpackages/client-runtime/src/state/orchestrationV2Subagents.ts Outdated
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from 85fe8a2 to 795eb20CompareJuly 28, 2026 19:46
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch from b270c47 to daf1a88CompareJuly 28, 2026 19:46
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from 795eb20 to 64bf642CompareJuly 28, 2026 20:26
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch 2 times, most recently from 1dce464 to 4c169edCompareJuly 29, 2026 01:19
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from 32cbb3d to c63297eCompareJuly 29, 2026 01:24
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch 2 times, most recently from 70d5111 to c78d0ffCompareJuly 30, 2026 00:00
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from c63297e to 4c70ab1CompareJuly 30, 2026 00:00
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch from c78d0ff to a997806CompareJuly 30, 2026 00:45
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from 4c70ab1 to d453837CompareJuly 30, 2026 00:45
@shivamhwp
shivamhwp marked this pull request as ready for review July 30, 2026 20:04
@macroscopeapp

macroscopeappBot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs human review

New feature introducing workflow visualization panel, inline run cards, and stop controls across server orchestration and web UI layers. The scope includes new components, a new command type (subagent.stop), and contract schema additions - warranting human review for a feature of this breadth.

No code changes detected at 27ecbe1. Prior analysis still applies.

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

@github-actionsgithub-actionsBot added size:XXL 1,000+ changed lines (additions + deletions). and removed size:L 100-499 changed lines (additions + deletions). labels Aug 1, 2026
@shivamhwpshivamhwp changed the title feat(web): add the Agents panel (4/5)feat(web): visualize workflows — agents panel, run cards, stop control (3/4)Aug 1, 2026
Comment threadapps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts
Comment threadapps/server/src/orchestration-v2/Orchestrator.ts Outdated

@macroscopeappmacroscopeappBot 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.

Effect service conventions review of the new stopTask surface (adapter runtime, ProviderTurnControlServiceV2, worker effect). Two findings, both in the error-modelling rules; the rest of the touched Effect code (namespace imports, layer/dependency acquisition, Layer.succeed only in test seams, no ManagedRuntime/runPromise outside boundaries) looks consistent with the conventions.

Posted via Macroscope — Effect Service Conventions

Comment threadapps/server/src/orchestration-v2/ProviderTurnControlService.ts Outdated
Comment threadapps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts Outdated

@cursorcursorBot 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 3 potential issues.

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 c9d6a7c. Configure here.

Comment threadapps/server/src/orchestration-v2/Orchestrator.ts
Comment threadapps/web/src/components/WorkflowRunCardV2.tsx
@shivamhwp

shivamhwp commented Aug 1, 2026

Copy link
Copy Markdown
CollaboratorAuthor

CI follow-up (2026-08-01): all code-bearing checks pass, including Test, Mobile Native Static Analysis, Release Smoke, Macroscope Effect Service Conventions, Macroscope Correctness, and Cursor Bugbot. The Check job was retried twice after its initial failure and hit the same Vite+ runner panic on all three attempts: failed printing to stdout: Resource temporarily unavailable (os error 11). Each attempt reported all 2,639 files correctly formatted before the panic. The top stacked branch at #4664, which contains this exact commit, has a green Check and Test. No source failure is being hidden here; this is recorded as an external CI runner blocker.

— Codex on behalf of shivamhwp

shivamhwpand others added 8 commits August 4, 2026 01:08
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>
The Workflow tool result is the run's only carrier of its disk handles
(script path, transcript dir, run id) and remote session URL. Attach them
to the coordinator's workflow struct so script view, transcripts, and
resume-command affordances have something to read.
The workflow input on updateClaudeSubagentNode becomes a merged partial:
phases arrive on progress snapshots, the name on task_started, and
handles on the tool result, so no writer may clobber the others.
Workflow tool_uses now skip toolCalls like Agent ones do — the
coordinator subagent row is the run's timeline representation, and
registering the tool call too would double-render it. The launch ACK
consequently routes through the subagent branch, which must not
terminalize the coordinator (only task_notification does).
sessionUrl is scheme-restricted to http(s) at the adapter; the replay
fixture carries a hostile javascript: URL to pin the filter.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A workflow previously appeared in the timeline as a bare subagent row per
coordinator and per member — no phases, no live status, and each member
double-reported as its own row. The coordinator's subagent item now
renders as a run card: phase-grouped member rows with live status dots,
a settled/total rollup, token usage, and a Details button that opens the
Agents panel. Members of a present coordinator render nothing (the card
already shows them); members orphaned by a missing coordinator keep
their row rather than disappearing.
Remote runs render their session link instead of member rows, re-checked
against the http(s) allowlist as defense in depth for payloads persisted
before the adapter-side filter. Rows cap at 8, keeping running and
failed agents plus the most recently updated; the remainder defers to
the Agents panel.
Live subagents ride a dedicated context rather than TimelineRowCtx so
progress-tick churn re-renders only subagent rows, not the whole list.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A running workflow previously could only be abandoned by interrupting
the whole run. A new subagent.stop command flows through the durable
command path: the decider validates the subagent is active and carries a
native task ref, records the user's intent as a Stop requested activity
on the subagent row, and queues a process-bound subagent.stop effect.
The effect worker resolves the session and calls the adapter's task stop
— for Claude, the SDK runtime's undocumented stopTask, read behind the
same single-cast convention as workflow_progress.
The provider's own task_notification remains the only terminalizer; the
command records intent, it does not fake a terminal state. A released
session is treated as already stopped (nothing can still be running
under it), while a runtime without task-level stop fails the effect
loudly. Stop effects are process-bound, so recovery cancels them after
process loss like the other session-scoped effects.
The web run card shows Stop only while the coordinator is active, wired
through thread environment commands as thread:stop-subagent.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… retries
Live testing showed every workflow agent wearing a "retry 2" badge on
its first attempt: the SDK reports attempt 1-based once an agent starts,
and the adapter added 1 on top assuming 0-based. Clamp absent or 0 up
to 1 instead of incrementing.
Found by a computer-use pass against a real workflow run; the replay
fixture's hand-authored attempt: 0 normalizes to the same 1 as before.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from b0398e1 to e151f62CompareAugust 3, 2026 19:44
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch from 76a62c7 to 27ecbe1CompareAugust 3, 2026 19:44
@shivamhwp

Copy link
Copy Markdown
CollaboratorAuthor

Converged into #4664, which now carries the full series against the orchestrator-v2 base — the commit history there preserves this PR's slice, and this PR's review record (findings and fix replies) remains the reference for it.

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

Labels

size:XXL1,000+ changed lines (additions + deletions).vouch:trustedPR 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

@shivamhwp
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

feat(web): visualize workflows — agents panel, run cards, stop control (3/4) - #4663

Closed
shivamhwp wants to merge 8 commits into
subagent-obs/03-reusefrom
subagent-obs/04-agents-panel
Closed

feat(web): visualize workflows — agents panel, run cards, stop control (3/4)#4663
shivamhwp wants to merge 8 commits into
subagent-obs/03-reusefrom
subagent-obs/04-agents-panel

Conversation

@shivamhwp

@shivamhwpshivamhwp commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Third of four stacked PRs. Stacked on #4662 — review that first; this diff is against it.

The user-visible half of the series: everything needed to see and control subagents and workflows. This is the "Visualize subagents and workflows" item, and it deliberately ports the best UI ideas from #3650 onto the v2 data model per that PR's close-out.

What's here

The Agents panel. A right-panel tab listing every subagent on the thread — role, model, status, token usage, recent activity, activations per run. Grouping lives in client-runtime so it stays testable: workflow coordinators own their phases, phase status derives from members, members orphaned by a missing coordinator fall back to the flat list rather than disappearing. Coordinators render as cards and are counted without double-reporting member usage.

Inline workflow run cards. A workflow previously appeared as a bare subagent row per coordinator and per member. The coordinator's timeline item now renders as a run card: phase-grouped member rows with live status dots, settled/total rollup, token usage, and a Details button opening the Agents panel. Members of a present coordinator render inside the card only; orphaned members keep their own row. Remote runs render their session link (scheme-restricted to http/https at the adapter and re-checked at the render site). Live subagents ride a dedicated React context so progress-tick churn re-renders only subagent rows, not the whole virtualized timeline.

Workflow run handles. The Workflow tool's launch ACK carries the run's script path, transcript dir, and run id; the adapter attaches them to the coordinator's workflow struct (a merged partial — phases, name, and handles arrive from three different frames and none may clobber the others). Workflow tool_uses now skip toolCalls like Agent ones do, so the run is represented once. These handles are the prerequisite for script view / transcript / resume affordances later.

Stop control. A new subagent.stop command through the durable command path: the decider validates the subagent is active, records "Stop requested" on its row, and queues a process-bound subagent.stop effect; the effect worker resolves the session and calls the adapter's task stop — for Claude, the SDK runtime's undocumented stopTask, read behind the same single-cast convention as workflow_progress. The provider's own task_notification remains the only terminalizer. A released session is treated as already stopped; a runtime without task-level stop fails the effect loudly; recovery cancels pending stop effects after process loss like the other session-scoped effects.

Verified against a live provider

A scripted browser pass against a real Claude session (screenshots on file):

  • The run card appeared with phases and live agent rows; completed at 2/2 agents · 32.7k tok; no duplicate member rows; no Workflow tool-call row; Details opened the panel; state survived a page reload.
  • Stop worked end to end: a 36-agent workflow flipped to Stopped within ~8s of the click; the protocol log shows the outgoing task.stop frame and the SDK's "status":"stopped" notifications coming back.
  • Live testing also caught a real bug, fixed in the last commit: the SDK reports agent attempt 1-based, and the adapter's 0-based assumption stamped every first-attempt agent with a spurious "retry 2" badge.

One observation for the record: after a stop, the parent Claude turn can keep running for minutes (the SDK's turn appears to wait on its dead background task). Our layer settles correctly; this is the known "provider accepts interrupt but never terminalizes" family in the interrupt-hardening TODO, not addressed here.

Testing

Typecheck and lint clean. Web 1,724 passing, client-runtime 539, server orchestration-v2 suite 575. New: run-card component tests, panel derivation tests, stopTask turn-control tests (live/released/unsupported session), extended claude_workflow replay fixture including a hostile javascript: sessionUrl pinned as dropped.


Note

Medium Risk
Touches orchestration command/effect paths and relies on an undocumented Claude SDK stopTask; UI and projection changes are broad but bounded, with explicit failure modes when stop is unsupported or sessions are gone.

Overview
User-facing: A new Agents right-panel tab groups subagents by workflow phase (coordinator cards, member rows, usage and activity). Workflow coordinators in the chat timeline render as inline run cards (phases, member status, Stop/Details) instead of duplicate subagent rows; live subagent projection uses a dedicated context so progress ticks do not re-render the whole timeline.

Stop path:subagent.stop runs through contracts → orchestrator (validates active subagent, emits “Stop requested”, queues effect) → effect worker → ProviderTurnControlService.stopTask → optional adapter stopTask. Claude calls the SDK runtime’s undocumented stopTask by native task id; released sessions are treated as already stopped; missing support fails the effect. Session routing prefers the run’s provider session, then the active thread.

Claude adapter: Workflow run handles (name, runId, scriptPath, transcriptDir, sessionUrl) merge into coordinator workflow without clobbering phases from progress frames; Workflow tool_uses skip toolCalls like Agent; workflow agent attempt is clamped to 1-based SDK reporting; sessionUrl is restricted to http(s) at ingestion.

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

Note

Add agents panel, workflow run cards, and subagent stop control to the chat UI

  • Adds a new AgentsPanelV2 right-panel surface that groups active subagents by workflow phase, shows coordinator cards with token usage and status, and renders direct agents; accessible via a new 'Agents' tab in RightPanelTabs.
  • Introduces WorkflowRunCardV2, an inline timeline card per workflow coordinator showing phase/member rows (capped at 8 with urgency-first ordering), aggregate token usage, run status, and a Stop button.
  • Implements end-to-end subagent stop: new subagent.stop command propagates from client runtime → contracts → orchestrator → EffectWorkerProviderTurnControlServiceClaudeAdapterV2.stopTask.
  • Extends OrchestrationV2Subagent to carry optional workflow run-handle fields (name, runId, scriptPath, transcriptDir, sessionUrl, warning); the Claude adapter extracts these from tool results while deferring settlement to task notifications.
  • Adds state-derivation helpers in orchestrationV2Subagents.ts (deriveOrchestrationV2SubagentPanelState, deriveOrchestrationV2WorkflowRunCard, orchestrationV2WorkflowMemberIds, formatSubagentTokenCount) backed by unit tests.
  • Risk: ClaudeAdapterV2 now calls an undocumented stopTask on the underlying SDK query runtime via a cast; if the SDK does not expose it, the stop fails with a ClaudeAgentSdkQueryRunnerError.

Macroscope summarized 27ecbe1.

Review-fix verification (2026-08-01)

  • c9d6a7c8a makes coordinator usage authoritative, makes Claude stop-without-live-query a warning/no-op, and restricts stop routing to the run-owned or explicitly active provider session.
  • Focused client/server tests pass, including coordinator totals larger than member totals and three provider-session routing cases.
  • Chrome verified the Codex Agents surface, settled counts, per-child usage, aggregate usage, and ordinary-command distinction.

Codex Agents panel

The fresh Claude workflow/Stop rerun could not reach a workflow card because the local Claude OAuth session had expired. The failure was surfaced visibly; current live Stop evidence is therefore blocked rather than claimed.

Claude provider blocker
\n### Final Effect review follow-up (2026-08-01)\n\n- 76a62c7 models the missing Claude stopTask capability as a direct typed failure and reuses an exported ProviderTaskStopError predicate.\n- Focused Claude adapter and provider turn-control tests pass: 52/52. Formatting is clean and the server typecheck exits successfully.\n\n### CI runner note (2026-08-01)\n\n- Test, mobile analysis, release smoke, Macroscope Effect, Macroscope correctness, and Bugbot pass on 76a62c7.\n- The Check job was retried twice after its initial failure. All three attempts reported all 2,639 files formatted, then Vite+ panicked while writing existing lint warnings to stdout with OS error 11 (resource temporarily unavailable).\n- The top stacked branch in #4664 contains this commit and has green Check and Test jobs. This is an external runner blocker, not a source diagnostic.\n

@coderabbitai

coderabbitaiBot 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: c6ee3086-b988-4b25-aced-c299a90e62f1

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-actionsgithub-actionsBot 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 threadapps/web/src/components/AgentsPanelV2.tsx Outdated
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch 2 times, most recently from c3a50f8 to 8c6a796CompareJuly 27, 2026 20:52
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from 5187d5b to cde2598CompareJuly 27, 2026 23:03
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch from 8c6a796 to 103b937CompareJuly 27, 2026 23:03
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from cde2598 to fc5b293CompareJuly 28, 2026 15:31
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch from 103b937 to 31adb36CompareJuly 28, 2026 15:31
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from fc5b293 to 85fe8a2CompareJuly 28, 2026 19:27
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch from 31adb36 to b270c47CompareJuly 28, 2026 19:27
Comment threadpackages/client-runtime/src/state/orchestrationV2Subagents.ts Outdated
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from 85fe8a2 to 795eb20CompareJuly 28, 2026 19:46
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch from b270c47 to daf1a88CompareJuly 28, 2026 19:46
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from 795eb20 to 64bf642CompareJuly 28, 2026 20:26
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch 2 times, most recently from 1dce464 to 4c169edCompareJuly 29, 2026 01:19
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from 32cbb3d to c63297eCompareJuly 29, 2026 01:24
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch 2 times, most recently from 70d5111 to c78d0ffCompareJuly 30, 2026 00:00
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from c63297e to 4c70ab1CompareJuly 30, 2026 00:00
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch from c78d0ff to a997806CompareJuly 30, 2026 00:45
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from 4c70ab1 to d453837CompareJuly 30, 2026 00:45
@shivamhwp
shivamhwp marked this pull request as ready for review July 30, 2026 20:04
@macroscopeapp

macroscopeappBot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs human review

New feature introducing workflow visualization panel, inline run cards, and stop controls across server orchestration and web UI layers. The scope includes new components, a new command type (subagent.stop), and contract schema additions - warranting human review for a feature of this breadth.

No code changes detected at 27ecbe1. Prior analysis still applies.

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

@github-actionsgithub-actionsBot added size:XXL 1,000+ changed lines (additions + deletions). and removed size:L 100-499 changed lines (additions + deletions). labels Aug 1, 2026
@shivamhwpshivamhwp changed the title feat(web): add the Agents panel (4/5)feat(web): visualize workflows — agents panel, run cards, stop control (3/4)Aug 1, 2026
Comment threadapps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts
Comment threadapps/server/src/orchestration-v2/Orchestrator.ts Outdated

@macroscopeappmacroscopeappBot 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.

Effect service conventions review of the new stopTask surface (adapter runtime, ProviderTurnControlServiceV2, worker effect). Two findings, both in the error-modelling rules; the rest of the touched Effect code (namespace imports, layer/dependency acquisition, Layer.succeed only in test seams, no ManagedRuntime/runPromise outside boundaries) looks consistent with the conventions.

Posted via Macroscope — Effect Service Conventions

Comment threadapps/server/src/orchestration-v2/ProviderTurnControlService.ts Outdated
Comment threadapps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts Outdated

@cursorcursorBot 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 3 potential issues.

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 c9d6a7c. Configure here.

Comment threadapps/server/src/orchestration-v2/Orchestrator.ts
Comment threadapps/web/src/components/WorkflowRunCardV2.tsx
@shivamhwp

shivamhwp commented Aug 1, 2026

Copy link
Copy Markdown
CollaboratorAuthor

CI follow-up (2026-08-01): all code-bearing checks pass, including Test, Mobile Native Static Analysis, Release Smoke, Macroscope Effect Service Conventions, Macroscope Correctness, and Cursor Bugbot. The Check job was retried twice after its initial failure and hit the same Vite+ runner panic on all three attempts: failed printing to stdout: Resource temporarily unavailable (os error 11). Each attempt reported all 2,639 files correctly formatted before the panic. The top stacked branch at #4664, which contains this exact commit, has a green Check and Test. No source failure is being hidden here; this is recorded as an external CI runner blocker.

— Codex on behalf of shivamhwp

shivamhwpand others added 8 commits August 4, 2026 01:08
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>
The Workflow tool result is the run's only carrier of its disk handles
(script path, transcript dir, run id) and remote session URL. Attach them
to the coordinator's workflow struct so script view, transcripts, and
resume-command affordances have something to read.
The workflow input on updateClaudeSubagentNode becomes a merged partial:
phases arrive on progress snapshots, the name on task_started, and
handles on the tool result, so no writer may clobber the others.
Workflow tool_uses now skip toolCalls like Agent ones do — the
coordinator subagent row is the run's timeline representation, and
registering the tool call too would double-render it. The launch ACK
consequently routes through the subagent branch, which must not
terminalize the coordinator (only task_notification does).
sessionUrl is scheme-restricted to http(s) at the adapter; the replay
fixture carries a hostile javascript: URL to pin the filter.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A workflow previously appeared in the timeline as a bare subagent row per
coordinator and per member — no phases, no live status, and each member
double-reported as its own row. The coordinator's subagent item now
renders as a run card: phase-grouped member rows with live status dots,
a settled/total rollup, token usage, and a Details button that opens the
Agents panel. Members of a present coordinator render nothing (the card
already shows them); members orphaned by a missing coordinator keep
their row rather than disappearing.
Remote runs render their session link instead of member rows, re-checked
against the http(s) allowlist as defense in depth for payloads persisted
before the adapter-side filter. Rows cap at 8, keeping running and
failed agents plus the most recently updated; the remainder defers to
the Agents panel.
Live subagents ride a dedicated context rather than TimelineRowCtx so
progress-tick churn re-renders only subagent rows, not the whole list.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A running workflow previously could only be abandoned by interrupting
the whole run. A new subagent.stop command flows through the durable
command path: the decider validates the subagent is active and carries a
native task ref, records the user's intent as a Stop requested activity
on the subagent row, and queues a process-bound subagent.stop effect.
The effect worker resolves the session and calls the adapter's task stop
— for Claude, the SDK runtime's undocumented stopTask, read behind the
same single-cast convention as workflow_progress.
The provider's own task_notification remains the only terminalizer; the
command records intent, it does not fake a terminal state. A released
session is treated as already stopped (nothing can still be running
under it), while a runtime without task-level stop fails the effect
loudly. Stop effects are process-bound, so recovery cancels them after
process loss like the other session-scoped effects.
The web run card shows Stop only while the coordinator is active, wired
through thread environment commands as thread:stop-subagent.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… retries
Live testing showed every workflow agent wearing a "retry 2" badge on
its first attempt: the SDK reports attempt 1-based once an agent starts,
and the adapter added 1 on top assuming 0-based. Clamp absent or 0 up
to 1 instead of incrementing.
Found by a computer-use pass against a real workflow run; the replay
fixture's hand-authored attempt: 0 normalizes to the same 1 as before.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from b0398e1 to e151f62CompareAugust 3, 2026 19:44
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch from 76a62c7 to 27ecbe1CompareAugust 3, 2026 19:44
@shivamhwp

Copy link
Copy Markdown
CollaboratorAuthor

Converged into #4664, which now carries the full series against the orchestrator-v2 base — the commit history there preserves this PR's slice, and this PR's review record (findings and fix replies) remains the reference for it.

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

Labels

size:XXL1,000+ changed lines (additions + deletions).vouch:trustedPR 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

@shivamhwp
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

feat(web): visualize workflows — agents panel, run cards, stop control (3/4) - #4663

Closed
shivamhwp wants to merge 8 commits into
subagent-obs/03-reusefrom
subagent-obs/04-agents-panel
Closed

feat(web): visualize workflows — agents panel, run cards, stop control (3/4)#4663
shivamhwp wants to merge 8 commits into
subagent-obs/03-reusefrom
subagent-obs/04-agents-panel

Conversation

@shivamhwp

@shivamhwpshivamhwp commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Third of four stacked PRs. Stacked on #4662 — review that first; this diff is against it.

The user-visible half of the series: everything needed to see and control subagents and workflows. This is the "Visualize subagents and workflows" item, and it deliberately ports the best UI ideas from #3650 onto the v2 data model per that PR's close-out.

What's here

The Agents panel. A right-panel tab listing every subagent on the thread — role, model, status, token usage, recent activity, activations per run. Grouping lives in client-runtime so it stays testable: workflow coordinators own their phases, phase status derives from members, members orphaned by a missing coordinator fall back to the flat list rather than disappearing. Coordinators render as cards and are counted without double-reporting member usage.

Inline workflow run cards. A workflow previously appeared as a bare subagent row per coordinator and per member. The coordinator's timeline item now renders as a run card: phase-grouped member rows with live status dots, settled/total rollup, token usage, and a Details button opening the Agents panel. Members of a present coordinator render inside the card only; orphaned members keep their own row. Remote runs render their session link (scheme-restricted to http/https at the adapter and re-checked at the render site). Live subagents ride a dedicated React context so progress-tick churn re-renders only subagent rows, not the whole virtualized timeline.

Workflow run handles. The Workflow tool's launch ACK carries the run's script path, transcript dir, and run id; the adapter attaches them to the coordinator's workflow struct (a merged partial — phases, name, and handles arrive from three different frames and none may clobber the others). Workflow tool_uses now skip toolCalls like Agent ones do, so the run is represented once. These handles are the prerequisite for script view / transcript / resume affordances later.

Stop control. A new subagent.stop command through the durable command path: the decider validates the subagent is active, records "Stop requested" on its row, and queues a process-bound subagent.stop effect; the effect worker resolves the session and calls the adapter's task stop — for Claude, the SDK runtime's undocumented stopTask, read behind the same single-cast convention as workflow_progress. The provider's own task_notification remains the only terminalizer. A released session is treated as already stopped; a runtime without task-level stop fails the effect loudly; recovery cancels pending stop effects after process loss like the other session-scoped effects.

Verified against a live provider

A scripted browser pass against a real Claude session (screenshots on file):

  • The run card appeared with phases and live agent rows; completed at 2/2 agents · 32.7k tok; no duplicate member rows; no Workflow tool-call row; Details opened the panel; state survived a page reload.
  • Stop worked end to end: a 36-agent workflow flipped to Stopped within ~8s of the click; the protocol log shows the outgoing task.stop frame and the SDK's "status":"stopped" notifications coming back.
  • Live testing also caught a real bug, fixed in the last commit: the SDK reports agent attempt 1-based, and the adapter's 0-based assumption stamped every first-attempt agent with a spurious "retry 2" badge.

One observation for the record: after a stop, the parent Claude turn can keep running for minutes (the SDK's turn appears to wait on its dead background task). Our layer settles correctly; this is the known "provider accepts interrupt but never terminalizes" family in the interrupt-hardening TODO, not addressed here.

Testing

Typecheck and lint clean. Web 1,724 passing, client-runtime 539, server orchestration-v2 suite 575. New: run-card component tests, panel derivation tests, stopTask turn-control tests (live/released/unsupported session), extended claude_workflow replay fixture including a hostile javascript: sessionUrl pinned as dropped.


Note

Medium Risk
Touches orchestration command/effect paths and relies on an undocumented Claude SDK stopTask; UI and projection changes are broad but bounded, with explicit failure modes when stop is unsupported or sessions are gone.

Overview
User-facing: A new Agents right-panel tab groups subagents by workflow phase (coordinator cards, member rows, usage and activity). Workflow coordinators in the chat timeline render as inline run cards (phases, member status, Stop/Details) instead of duplicate subagent rows; live subagent projection uses a dedicated context so progress ticks do not re-render the whole timeline.

Stop path:subagent.stop runs through contracts → orchestrator (validates active subagent, emits “Stop requested”, queues effect) → effect worker → ProviderTurnControlService.stopTask → optional adapter stopTask. Claude calls the SDK runtime’s undocumented stopTask by native task id; released sessions are treated as already stopped; missing support fails the effect. Session routing prefers the run’s provider session, then the active thread.

Claude adapter: Workflow run handles (name, runId, scriptPath, transcriptDir, sessionUrl) merge into coordinator workflow without clobbering phases from progress frames; Workflow tool_uses skip toolCalls like Agent; workflow agent attempt is clamped to 1-based SDK reporting; sessionUrl is restricted to http(s) at ingestion.

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

Note

Add agents panel, workflow run cards, and subagent stop control to the chat UI

  • Adds a new AgentsPanelV2 right-panel surface that groups active subagents by workflow phase, shows coordinator cards with token usage and status, and renders direct agents; accessible via a new 'Agents' tab in RightPanelTabs.
  • Introduces WorkflowRunCardV2, an inline timeline card per workflow coordinator showing phase/member rows (capped at 8 with urgency-first ordering), aggregate token usage, run status, and a Stop button.
  • Implements end-to-end subagent stop: new subagent.stop command propagates from client runtime → contracts → orchestrator → EffectWorkerProviderTurnControlServiceClaudeAdapterV2.stopTask.
  • Extends OrchestrationV2Subagent to carry optional workflow run-handle fields (name, runId, scriptPath, transcriptDir, sessionUrl, warning); the Claude adapter extracts these from tool results while deferring settlement to task notifications.
  • Adds state-derivation helpers in orchestrationV2Subagents.ts (deriveOrchestrationV2SubagentPanelState, deriveOrchestrationV2WorkflowRunCard, orchestrationV2WorkflowMemberIds, formatSubagentTokenCount) backed by unit tests.
  • Risk: ClaudeAdapterV2 now calls an undocumented stopTask on the underlying SDK query runtime via a cast; if the SDK does not expose it, the stop fails with a ClaudeAgentSdkQueryRunnerError.

Macroscope summarized 27ecbe1.

Review-fix verification (2026-08-01)

  • c9d6a7c8a makes coordinator usage authoritative, makes Claude stop-without-live-query a warning/no-op, and restricts stop routing to the run-owned or explicitly active provider session.
  • Focused client/server tests pass, including coordinator totals larger than member totals and three provider-session routing cases.
  • Chrome verified the Codex Agents surface, settled counts, per-child usage, aggregate usage, and ordinary-command distinction.

Codex Agents panel

The fresh Claude workflow/Stop rerun could not reach a workflow card because the local Claude OAuth session had expired. The failure was surfaced visibly; current live Stop evidence is therefore blocked rather than claimed.

Claude provider blocker
\n### Final Effect review follow-up (2026-08-01)\n\n- 76a62c7 models the missing Claude stopTask capability as a direct typed failure and reuses an exported ProviderTaskStopError predicate.\n- Focused Claude adapter and provider turn-control tests pass: 52/52. Formatting is clean and the server typecheck exits successfully.\n\n### CI runner note (2026-08-01)\n\n- Test, mobile analysis, release smoke, Macroscope Effect, Macroscope correctness, and Bugbot pass on 76a62c7.\n- The Check job was retried twice after its initial failure. All three attempts reported all 2,639 files formatted, then Vite+ panicked while writing existing lint warnings to stdout with OS error 11 (resource temporarily unavailable).\n- The top stacked branch in #4664 contains this commit and has green Check and Test jobs. This is an external runner blocker, not a source diagnostic.\n

@coderabbitai

coderabbitaiBot 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: c6ee3086-b988-4b25-aced-c299a90e62f1

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-actionsgithub-actionsBot 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 threadapps/web/src/components/AgentsPanelV2.tsx Outdated
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch 2 times, most recently from c3a50f8 to 8c6a796CompareJuly 27, 2026 20:52
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from 5187d5b to cde2598CompareJuly 27, 2026 23:03
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch from 8c6a796 to 103b937CompareJuly 27, 2026 23:03
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from cde2598 to fc5b293CompareJuly 28, 2026 15:31
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch from 103b937 to 31adb36CompareJuly 28, 2026 15:31
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from fc5b293 to 85fe8a2CompareJuly 28, 2026 19:27
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch from 31adb36 to b270c47CompareJuly 28, 2026 19:27
Comment threadpackages/client-runtime/src/state/orchestrationV2Subagents.ts Outdated
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from 85fe8a2 to 795eb20CompareJuly 28, 2026 19:46
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch from b270c47 to daf1a88CompareJuly 28, 2026 19:46
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from 795eb20 to 64bf642CompareJuly 28, 2026 20:26
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch 2 times, most recently from 1dce464 to 4c169edCompareJuly 29, 2026 01:19
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from 32cbb3d to c63297eCompareJuly 29, 2026 01:24
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch 2 times, most recently from 70d5111 to c78d0ffCompareJuly 30, 2026 00:00
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from c63297e to 4c70ab1CompareJuly 30, 2026 00:00
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch from c78d0ff to a997806CompareJuly 30, 2026 00:45
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from 4c70ab1 to d453837CompareJuly 30, 2026 00:45
@shivamhwp
shivamhwp marked this pull request as ready for review July 30, 2026 20:04
@macroscopeapp

macroscopeappBot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs human review

New feature introducing workflow visualization panel, inline run cards, and stop controls across server orchestration and web UI layers. The scope includes new components, a new command type (subagent.stop), and contract schema additions - warranting human review for a feature of this breadth.

No code changes detected at 27ecbe1. Prior analysis still applies.

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

@github-actionsgithub-actionsBot added size:XXL 1,000+ changed lines (additions + deletions). and removed size:L 100-499 changed lines (additions + deletions). labels Aug 1, 2026
@shivamhwpshivamhwp changed the title feat(web): add the Agents panel (4/5)feat(web): visualize workflows — agents panel, run cards, stop control (3/4)Aug 1, 2026
Comment threadapps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts
Comment threadapps/server/src/orchestration-v2/Orchestrator.ts Outdated

@macroscopeappmacroscopeappBot 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.

Effect service conventions review of the new stopTask surface (adapter runtime, ProviderTurnControlServiceV2, worker effect). Two findings, both in the error-modelling rules; the rest of the touched Effect code (namespace imports, layer/dependency acquisition, Layer.succeed only in test seams, no ManagedRuntime/runPromise outside boundaries) looks consistent with the conventions.

Posted via Macroscope — Effect Service Conventions

Comment threadapps/server/src/orchestration-v2/ProviderTurnControlService.ts Outdated
Comment threadapps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts Outdated

@cursorcursorBot 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 3 potential issues.

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 c9d6a7c. Configure here.

Comment threadapps/server/src/orchestration-v2/Orchestrator.ts
Comment threadapps/web/src/components/WorkflowRunCardV2.tsx
@shivamhwp

shivamhwp commented Aug 1, 2026

Copy link
Copy Markdown
CollaboratorAuthor

CI follow-up (2026-08-01): all code-bearing checks pass, including Test, Mobile Native Static Analysis, Release Smoke, Macroscope Effect Service Conventions, Macroscope Correctness, and Cursor Bugbot. The Check job was retried twice after its initial failure and hit the same Vite+ runner panic on all three attempts: failed printing to stdout: Resource temporarily unavailable (os error 11). Each attempt reported all 2,639 files correctly formatted before the panic. The top stacked branch at #4664, which contains this exact commit, has a green Check and Test. No source failure is being hidden here; this is recorded as an external CI runner blocker.

— Codex on behalf of shivamhwp

shivamhwpand others added 8 commits August 4, 2026 01:08
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>
The Workflow tool result is the run's only carrier of its disk handles
(script path, transcript dir, run id) and remote session URL. Attach them
to the coordinator's workflow struct so script view, transcripts, and
resume-command affordances have something to read.
The workflow input on updateClaudeSubagentNode becomes a merged partial:
phases arrive on progress snapshots, the name on task_started, and
handles on the tool result, so no writer may clobber the others.
Workflow tool_uses now skip toolCalls like Agent ones do — the
coordinator subagent row is the run's timeline representation, and
registering the tool call too would double-render it. The launch ACK
consequently routes through the subagent branch, which must not
terminalize the coordinator (only task_notification does).
sessionUrl is scheme-restricted to http(s) at the adapter; the replay
fixture carries a hostile javascript: URL to pin the filter.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A workflow previously appeared in the timeline as a bare subagent row per
coordinator and per member — no phases, no live status, and each member
double-reported as its own row. The coordinator's subagent item now
renders as a run card: phase-grouped member rows with live status dots,
a settled/total rollup, token usage, and a Details button that opens the
Agents panel. Members of a present coordinator render nothing (the card
already shows them); members orphaned by a missing coordinator keep
their row rather than disappearing.
Remote runs render their session link instead of member rows, re-checked
against the http(s) allowlist as defense in depth for payloads persisted
before the adapter-side filter. Rows cap at 8, keeping running and
failed agents plus the most recently updated; the remainder defers to
the Agents panel.
Live subagents ride a dedicated context rather than TimelineRowCtx so
progress-tick churn re-renders only subagent rows, not the whole list.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A running workflow previously could only be abandoned by interrupting
the whole run. A new subagent.stop command flows through the durable
command path: the decider validates the subagent is active and carries a
native task ref, records the user's intent as a Stop requested activity
on the subagent row, and queues a process-bound subagent.stop effect.
The effect worker resolves the session and calls the adapter's task stop
— for Claude, the SDK runtime's undocumented stopTask, read behind the
same single-cast convention as workflow_progress.
The provider's own task_notification remains the only terminalizer; the
command records intent, it does not fake a terminal state. A released
session is treated as already stopped (nothing can still be running
under it), while a runtime without task-level stop fails the effect
loudly. Stop effects are process-bound, so recovery cancels them after
process loss like the other session-scoped effects.
The web run card shows Stop only while the coordinator is active, wired
through thread environment commands as thread:stop-subagent.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… retries
Live testing showed every workflow agent wearing a "retry 2" badge on
its first attempt: the SDK reports attempt 1-based once an agent starts,
and the adapter added 1 on top assuming 0-based. Clamp absent or 0 up
to 1 instead of incrementing.
Found by a computer-use pass against a real workflow run; the replay
fixture's hand-authored attempt: 0 normalizes to the same 1 as before.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from b0398e1 to e151f62CompareAugust 3, 2026 19:44
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch from 76a62c7 to 27ecbe1CompareAugust 3, 2026 19:44
@shivamhwp

Copy link
Copy Markdown
CollaboratorAuthor

Converged into #4664, which now carries the full series against the orchestrator-v2 base — the commit history there preserves this PR's slice, and this PR's review record (findings and fix replies) remains the reference for it.

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

Labels

size:XXL1,000+ changed lines (additions + deletions).vouch:trustedPR 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

@shivamhwp
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

feat(web): visualize workflows — agents panel, run cards, stop control (3/4) - #4663

Closed
shivamhwp wants to merge 8 commits into
subagent-obs/03-reusefrom
subagent-obs/04-agents-panel
Closed

feat(web): visualize workflows — agents panel, run cards, stop control (3/4)#4663
shivamhwp wants to merge 8 commits into
subagent-obs/03-reusefrom
subagent-obs/04-agents-panel

Conversation

@shivamhwp

@shivamhwpshivamhwp commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Third of four stacked PRs. Stacked on #4662 — review that first; this diff is against it.

The user-visible half of the series: everything needed to see and control subagents and workflows. This is the "Visualize subagents and workflows" item, and it deliberately ports the best UI ideas from #3650 onto the v2 data model per that PR's close-out.

What's here

The Agents panel. A right-panel tab listing every subagent on the thread — role, model, status, token usage, recent activity, activations per run. Grouping lives in client-runtime so it stays testable: workflow coordinators own their phases, phase status derives from members, members orphaned by a missing coordinator fall back to the flat list rather than disappearing. Coordinators render as cards and are counted without double-reporting member usage.

Inline workflow run cards. A workflow previously appeared as a bare subagent row per coordinator and per member. The coordinator's timeline item now renders as a run card: phase-grouped member rows with live status dots, settled/total rollup, token usage, and a Details button opening the Agents panel. Members of a present coordinator render inside the card only; orphaned members keep their own row. Remote runs render their session link (scheme-restricted to http/https at the adapter and re-checked at the render site). Live subagents ride a dedicated React context so progress-tick churn re-renders only subagent rows, not the whole virtualized timeline.

Workflow run handles. The Workflow tool's launch ACK carries the run's script path, transcript dir, and run id; the adapter attaches them to the coordinator's workflow struct (a merged partial — phases, name, and handles arrive from three different frames and none may clobber the others). Workflow tool_uses now skip toolCalls like Agent ones do, so the run is represented once. These handles are the prerequisite for script view / transcript / resume affordances later.

Stop control. A new subagent.stop command through the durable command path: the decider validates the subagent is active, records "Stop requested" on its row, and queues a process-bound subagent.stop effect; the effect worker resolves the session and calls the adapter's task stop — for Claude, the SDK runtime's undocumented stopTask, read behind the same single-cast convention as workflow_progress. The provider's own task_notification remains the only terminalizer. A released session is treated as already stopped; a runtime without task-level stop fails the effect loudly; recovery cancels pending stop effects after process loss like the other session-scoped effects.

Verified against a live provider

A scripted browser pass against a real Claude session (screenshots on file):

  • The run card appeared with phases and live agent rows; completed at 2/2 agents · 32.7k tok; no duplicate member rows; no Workflow tool-call row; Details opened the panel; state survived a page reload.
  • Stop worked end to end: a 36-agent workflow flipped to Stopped within ~8s of the click; the protocol log shows the outgoing task.stop frame and the SDK's "status":"stopped" notifications coming back.
  • Live testing also caught a real bug, fixed in the last commit: the SDK reports agent attempt 1-based, and the adapter's 0-based assumption stamped every first-attempt agent with a spurious "retry 2" badge.

One observation for the record: after a stop, the parent Claude turn can keep running for minutes (the SDK's turn appears to wait on its dead background task). Our layer settles correctly; this is the known "provider accepts interrupt but never terminalizes" family in the interrupt-hardening TODO, not addressed here.

Testing

Typecheck and lint clean. Web 1,724 passing, client-runtime 539, server orchestration-v2 suite 575. New: run-card component tests, panel derivation tests, stopTask turn-control tests (live/released/unsupported session), extended claude_workflow replay fixture including a hostile javascript: sessionUrl pinned as dropped.


Note

Medium Risk
Touches orchestration command/effect paths and relies on an undocumented Claude SDK stopTask; UI and projection changes are broad but bounded, with explicit failure modes when stop is unsupported or sessions are gone.

Overview
User-facing: A new Agents right-panel tab groups subagents by workflow phase (coordinator cards, member rows, usage and activity). Workflow coordinators in the chat timeline render as inline run cards (phases, member status, Stop/Details) instead of duplicate subagent rows; live subagent projection uses a dedicated context so progress ticks do not re-render the whole timeline.

Stop path:subagent.stop runs through contracts → orchestrator (validates active subagent, emits “Stop requested”, queues effect) → effect worker → ProviderTurnControlService.stopTask → optional adapter stopTask. Claude calls the SDK runtime’s undocumented stopTask by native task id; released sessions are treated as already stopped; missing support fails the effect. Session routing prefers the run’s provider session, then the active thread.

Claude adapter: Workflow run handles (name, runId, scriptPath, transcriptDir, sessionUrl) merge into coordinator workflow without clobbering phases from progress frames; Workflow tool_uses skip toolCalls like Agent; workflow agent attempt is clamped to 1-based SDK reporting; sessionUrl is restricted to http(s) at ingestion.

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

Note

Add agents panel, workflow run cards, and subagent stop control to the chat UI

  • Adds a new AgentsPanelV2 right-panel surface that groups active subagents by workflow phase, shows coordinator cards with token usage and status, and renders direct agents; accessible via a new 'Agents' tab in RightPanelTabs.
  • Introduces WorkflowRunCardV2, an inline timeline card per workflow coordinator showing phase/member rows (capped at 8 with urgency-first ordering), aggregate token usage, run status, and a Stop button.
  • Implements end-to-end subagent stop: new subagent.stop command propagates from client runtime → contracts → orchestrator → EffectWorkerProviderTurnControlServiceClaudeAdapterV2.stopTask.
  • Extends OrchestrationV2Subagent to carry optional workflow run-handle fields (name, runId, scriptPath, transcriptDir, sessionUrl, warning); the Claude adapter extracts these from tool results while deferring settlement to task notifications.
  • Adds state-derivation helpers in orchestrationV2Subagents.ts (deriveOrchestrationV2SubagentPanelState, deriveOrchestrationV2WorkflowRunCard, orchestrationV2WorkflowMemberIds, formatSubagentTokenCount) backed by unit tests.
  • Risk: ClaudeAdapterV2 now calls an undocumented stopTask on the underlying SDK query runtime via a cast; if the SDK does not expose it, the stop fails with a ClaudeAgentSdkQueryRunnerError.

Macroscope summarized 27ecbe1.

Review-fix verification (2026-08-01)

  • c9d6a7c8a makes coordinator usage authoritative, makes Claude stop-without-live-query a warning/no-op, and restricts stop routing to the run-owned or explicitly active provider session.
  • Focused client/server tests pass, including coordinator totals larger than member totals and three provider-session routing cases.
  • Chrome verified the Codex Agents surface, settled counts, per-child usage, aggregate usage, and ordinary-command distinction.

Codex Agents panel

The fresh Claude workflow/Stop rerun could not reach a workflow card because the local Claude OAuth session had expired. The failure was surfaced visibly; current live Stop evidence is therefore blocked rather than claimed.

Claude provider blocker
\n### Final Effect review follow-up (2026-08-01)\n\n- 76a62c7 models the missing Claude stopTask capability as a direct typed failure and reuses an exported ProviderTaskStopError predicate.\n- Focused Claude adapter and provider turn-control tests pass: 52/52. Formatting is clean and the server typecheck exits successfully.\n\n### CI runner note (2026-08-01)\n\n- Test, mobile analysis, release smoke, Macroscope Effect, Macroscope correctness, and Bugbot pass on 76a62c7.\n- The Check job was retried twice after its initial failure. All three attempts reported all 2,639 files formatted, then Vite+ panicked while writing existing lint warnings to stdout with OS error 11 (resource temporarily unavailable).\n- The top stacked branch in #4664 contains this commit and has green Check and Test jobs. This is an external runner blocker, not a source diagnostic.\n

@coderabbitai

coderabbitaiBot 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: c6ee3086-b988-4b25-aced-c299a90e62f1

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-actionsgithub-actionsBot 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 threadapps/web/src/components/AgentsPanelV2.tsx Outdated
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch 2 times, most recently from c3a50f8 to 8c6a796CompareJuly 27, 2026 20:52
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from 5187d5b to cde2598CompareJuly 27, 2026 23:03
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch from 8c6a796 to 103b937CompareJuly 27, 2026 23:03
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from cde2598 to fc5b293CompareJuly 28, 2026 15:31
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch from 103b937 to 31adb36CompareJuly 28, 2026 15:31
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from fc5b293 to 85fe8a2CompareJuly 28, 2026 19:27
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch from 31adb36 to b270c47CompareJuly 28, 2026 19:27
Comment threadpackages/client-runtime/src/state/orchestrationV2Subagents.ts Outdated
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from 85fe8a2 to 795eb20CompareJuly 28, 2026 19:46
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch from b270c47 to daf1a88CompareJuly 28, 2026 19:46
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from 795eb20 to 64bf642CompareJuly 28, 2026 20:26
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch 2 times, most recently from 1dce464 to 4c169edCompareJuly 29, 2026 01:19
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from 32cbb3d to c63297eCompareJuly 29, 2026 01:24
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch 2 times, most recently from 70d5111 to c78d0ffCompareJuly 30, 2026 00:00
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from c63297e to 4c70ab1CompareJuly 30, 2026 00:00
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch from c78d0ff to a997806CompareJuly 30, 2026 00:45
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from 4c70ab1 to d453837CompareJuly 30, 2026 00:45
@shivamhwp
shivamhwp marked this pull request as ready for review July 30, 2026 20:04
@macroscopeapp

macroscopeappBot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs human review

New feature introducing workflow visualization panel, inline run cards, and stop controls across server orchestration and web UI layers. The scope includes new components, a new command type (subagent.stop), and contract schema additions - warranting human review for a feature of this breadth.

No code changes detected at 27ecbe1. Prior analysis still applies.

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

@github-actionsgithub-actionsBot added size:XXL 1,000+ changed lines (additions + deletions). and removed size:L 100-499 changed lines (additions + deletions). labels Aug 1, 2026
@shivamhwpshivamhwp changed the title feat(web): add the Agents panel (4/5)feat(web): visualize workflows — agents panel, run cards, stop control (3/4)Aug 1, 2026
Comment threadapps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts
Comment threadapps/server/src/orchestration-v2/Orchestrator.ts Outdated

@macroscopeappmacroscopeappBot 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.

Effect service conventions review of the new stopTask surface (adapter runtime, ProviderTurnControlServiceV2, worker effect). Two findings, both in the error-modelling rules; the rest of the touched Effect code (namespace imports, layer/dependency acquisition, Layer.succeed only in test seams, no ManagedRuntime/runPromise outside boundaries) looks consistent with the conventions.

Posted via Macroscope — Effect Service Conventions

Comment threadapps/server/src/orchestration-v2/ProviderTurnControlService.ts Outdated
Comment threadapps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts Outdated

@cursorcursorBot 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 3 potential issues.

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 c9d6a7c. Configure here.

Comment threadapps/server/src/orchestration-v2/Orchestrator.ts
Comment threadapps/web/src/components/WorkflowRunCardV2.tsx
@shivamhwp

shivamhwp commented Aug 1, 2026

Copy link
Copy Markdown
CollaboratorAuthor

CI follow-up (2026-08-01): all code-bearing checks pass, including Test, Mobile Native Static Analysis, Release Smoke, Macroscope Effect Service Conventions, Macroscope Correctness, and Cursor Bugbot. The Check job was retried twice after its initial failure and hit the same Vite+ runner panic on all three attempts: failed printing to stdout: Resource temporarily unavailable (os error 11). Each attempt reported all 2,639 files correctly formatted before the panic. The top stacked branch at #4664, which contains this exact commit, has a green Check and Test. No source failure is being hidden here; this is recorded as an external CI runner blocker.

— Codex on behalf of shivamhwp

shivamhwpand others added 8 commits August 4, 2026 01:08
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>
The Workflow tool result is the run's only carrier of its disk handles
(script path, transcript dir, run id) and remote session URL. Attach them
to the coordinator's workflow struct so script view, transcripts, and
resume-command affordances have something to read.
The workflow input on updateClaudeSubagentNode becomes a merged partial:
phases arrive on progress snapshots, the name on task_started, and
handles on the tool result, so no writer may clobber the others.
Workflow tool_uses now skip toolCalls like Agent ones do — the
coordinator subagent row is the run's timeline representation, and
registering the tool call too would double-render it. The launch ACK
consequently routes through the subagent branch, which must not
terminalize the coordinator (only task_notification does).
sessionUrl is scheme-restricted to http(s) at the adapter; the replay
fixture carries a hostile javascript: URL to pin the filter.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A workflow previously appeared in the timeline as a bare subagent row per
coordinator and per member — no phases, no live status, and each member
double-reported as its own row. The coordinator's subagent item now
renders as a run card: phase-grouped member rows with live status dots,
a settled/total rollup, token usage, and a Details button that opens the
Agents panel. Members of a present coordinator render nothing (the card
already shows them); members orphaned by a missing coordinator keep
their row rather than disappearing.
Remote runs render their session link instead of member rows, re-checked
against the http(s) allowlist as defense in depth for payloads persisted
before the adapter-side filter. Rows cap at 8, keeping running and
failed agents plus the most recently updated; the remainder defers to
the Agents panel.
Live subagents ride a dedicated context rather than TimelineRowCtx so
progress-tick churn re-renders only subagent rows, not the whole list.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A running workflow previously could only be abandoned by interrupting
the whole run. A new subagent.stop command flows through the durable
command path: the decider validates the subagent is active and carries a
native task ref, records the user's intent as a Stop requested activity
on the subagent row, and queues a process-bound subagent.stop effect.
The effect worker resolves the session and calls the adapter's task stop
— for Claude, the SDK runtime's undocumented stopTask, read behind the
same single-cast convention as workflow_progress.
The provider's own task_notification remains the only terminalizer; the
command records intent, it does not fake a terminal state. A released
session is treated as already stopped (nothing can still be running
under it), while a runtime without task-level stop fails the effect
loudly. Stop effects are process-bound, so recovery cancels them after
process loss like the other session-scoped effects.
The web run card shows Stop only while the coordinator is active, wired
through thread environment commands as thread:stop-subagent.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… retries
Live testing showed every workflow agent wearing a "retry 2" badge on
its first attempt: the SDK reports attempt 1-based once an agent starts,
and the adapter added 1 on top assuming 0-based. Clamp absent or 0 up
to 1 instead of incrementing.
Found by a computer-use pass against a real workflow run; the replay
fixture's hand-authored attempt: 0 normalizes to the same 1 as before.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from b0398e1 to e151f62CompareAugust 3, 2026 19:44
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch from 76a62c7 to 27ecbe1CompareAugust 3, 2026 19:44
@shivamhwp

Copy link
Copy Markdown
CollaboratorAuthor

Converged into #4664, which now carries the full series against the orchestrator-v2 base — the commit history there preserves this PR's slice, and this PR's review record (findings and fix replies) remains the reference for it.

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

Labels

size:XXL1,000+ changed lines (additions + deletions).vouch:trustedPR 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

@shivamhwp
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

feat(web): visualize workflows — agents panel, run cards, stop control (3/4) - #4663

Closed
shivamhwp wants to merge 8 commits into
subagent-obs/03-reusefrom
subagent-obs/04-agents-panel
Closed

feat(web): visualize workflows — agents panel, run cards, stop control (3/4)#4663
shivamhwp wants to merge 8 commits into
subagent-obs/03-reusefrom
subagent-obs/04-agents-panel

Conversation

@shivamhwp

@shivamhwpshivamhwp commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Third of four stacked PRs. Stacked on #4662 — review that first; this diff is against it.

The user-visible half of the series: everything needed to see and control subagents and workflows. This is the "Visualize subagents and workflows" item, and it deliberately ports the best UI ideas from #3650 onto the v2 data model per that PR's close-out.

What's here

The Agents panel. A right-panel tab listing every subagent on the thread — role, model, status, token usage, recent activity, activations per run. Grouping lives in client-runtime so it stays testable: workflow coordinators own their phases, phase status derives from members, members orphaned by a missing coordinator fall back to the flat list rather than disappearing. Coordinators render as cards and are counted without double-reporting member usage.

Inline workflow run cards. A workflow previously appeared as a bare subagent row per coordinator and per member. The coordinator's timeline item now renders as a run card: phase-grouped member rows with live status dots, settled/total rollup, token usage, and a Details button opening the Agents panel. Members of a present coordinator render inside the card only; orphaned members keep their own row. Remote runs render their session link (scheme-restricted to http/https at the adapter and re-checked at the render site). Live subagents ride a dedicated React context so progress-tick churn re-renders only subagent rows, not the whole virtualized timeline.

Workflow run handles. The Workflow tool's launch ACK carries the run's script path, transcript dir, and run id; the adapter attaches them to the coordinator's workflow struct (a merged partial — phases, name, and handles arrive from three different frames and none may clobber the others). Workflow tool_uses now skip toolCalls like Agent ones do, so the run is represented once. These handles are the prerequisite for script view / transcript / resume affordances later.

Stop control. A new subagent.stop command through the durable command path: the decider validates the subagent is active, records "Stop requested" on its row, and queues a process-bound subagent.stop effect; the effect worker resolves the session and calls the adapter's task stop — for Claude, the SDK runtime's undocumented stopTask, read behind the same single-cast convention as workflow_progress. The provider's own task_notification remains the only terminalizer. A released session is treated as already stopped; a runtime without task-level stop fails the effect loudly; recovery cancels pending stop effects after process loss like the other session-scoped effects.

Verified against a live provider

A scripted browser pass against a real Claude session (screenshots on file):

  • The run card appeared with phases and live agent rows; completed at 2/2 agents · 32.7k tok; no duplicate member rows; no Workflow tool-call row; Details opened the panel; state survived a page reload.
  • Stop worked end to end: a 36-agent workflow flipped to Stopped within ~8s of the click; the protocol log shows the outgoing task.stop frame and the SDK's "status":"stopped" notifications coming back.
  • Live testing also caught a real bug, fixed in the last commit: the SDK reports agent attempt 1-based, and the adapter's 0-based assumption stamped every first-attempt agent with a spurious "retry 2" badge.

One observation for the record: after a stop, the parent Claude turn can keep running for minutes (the SDK's turn appears to wait on its dead background task). Our layer settles correctly; this is the known "provider accepts interrupt but never terminalizes" family in the interrupt-hardening TODO, not addressed here.

Testing

Typecheck and lint clean. Web 1,724 passing, client-runtime 539, server orchestration-v2 suite 575. New: run-card component tests, panel derivation tests, stopTask turn-control tests (live/released/unsupported session), extended claude_workflow replay fixture including a hostile javascript: sessionUrl pinned as dropped.


Note

Medium Risk
Touches orchestration command/effect paths and relies on an undocumented Claude SDK stopTask; UI and projection changes are broad but bounded, with explicit failure modes when stop is unsupported or sessions are gone.

Overview
User-facing: A new Agents right-panel tab groups subagents by workflow phase (coordinator cards, member rows, usage and activity). Workflow coordinators in the chat timeline render as inline run cards (phases, member status, Stop/Details) instead of duplicate subagent rows; live subagent projection uses a dedicated context so progress ticks do not re-render the whole timeline.

Stop path:subagent.stop runs through contracts → orchestrator (validates active subagent, emits “Stop requested”, queues effect) → effect worker → ProviderTurnControlService.stopTask → optional adapter stopTask. Claude calls the SDK runtime’s undocumented stopTask by native task id; released sessions are treated as already stopped; missing support fails the effect. Session routing prefers the run’s provider session, then the active thread.

Claude adapter: Workflow run handles (name, runId, scriptPath, transcriptDir, sessionUrl) merge into coordinator workflow without clobbering phases from progress frames; Workflow tool_uses skip toolCalls like Agent; workflow agent attempt is clamped to 1-based SDK reporting; sessionUrl is restricted to http(s) at ingestion.

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

Note

Add agents panel, workflow run cards, and subagent stop control to the chat UI

  • Adds a new AgentsPanelV2 right-panel surface that groups active subagents by workflow phase, shows coordinator cards with token usage and status, and renders direct agents; accessible via a new 'Agents' tab in RightPanelTabs.
  • Introduces WorkflowRunCardV2, an inline timeline card per workflow coordinator showing phase/member rows (capped at 8 with urgency-first ordering), aggregate token usage, run status, and a Stop button.
  • Implements end-to-end subagent stop: new subagent.stop command propagates from client runtime → contracts → orchestrator → EffectWorkerProviderTurnControlServiceClaudeAdapterV2.stopTask.
  • Extends OrchestrationV2Subagent to carry optional workflow run-handle fields (name, runId, scriptPath, transcriptDir, sessionUrl, warning); the Claude adapter extracts these from tool results while deferring settlement to task notifications.
  • Adds state-derivation helpers in orchestrationV2Subagents.ts (deriveOrchestrationV2SubagentPanelState, deriveOrchestrationV2WorkflowRunCard, orchestrationV2WorkflowMemberIds, formatSubagentTokenCount) backed by unit tests.
  • Risk: ClaudeAdapterV2 now calls an undocumented stopTask on the underlying SDK query runtime via a cast; if the SDK does not expose it, the stop fails with a ClaudeAgentSdkQueryRunnerError.

Macroscope summarized 27ecbe1.

Review-fix verification (2026-08-01)

  • c9d6a7c8a makes coordinator usage authoritative, makes Claude stop-without-live-query a warning/no-op, and restricts stop routing to the run-owned or explicitly active provider session.
  • Focused client/server tests pass, including coordinator totals larger than member totals and three provider-session routing cases.
  • Chrome verified the Codex Agents surface, settled counts, per-child usage, aggregate usage, and ordinary-command distinction.

Codex Agents panel

The fresh Claude workflow/Stop rerun could not reach a workflow card because the local Claude OAuth session had expired. The failure was surfaced visibly; current live Stop evidence is therefore blocked rather than claimed.

Claude provider blocker
\n### Final Effect review follow-up (2026-08-01)\n\n- 76a62c7 models the missing Claude stopTask capability as a direct typed failure and reuses an exported ProviderTaskStopError predicate.\n- Focused Claude adapter and provider turn-control tests pass: 52/52. Formatting is clean and the server typecheck exits successfully.\n\n### CI runner note (2026-08-01)\n\n- Test, mobile analysis, release smoke, Macroscope Effect, Macroscope correctness, and Bugbot pass on 76a62c7.\n- The Check job was retried twice after its initial failure. All three attempts reported all 2,639 files formatted, then Vite+ panicked while writing existing lint warnings to stdout with OS error 11 (resource temporarily unavailable).\n- The top stacked branch in #4664 contains this commit and has green Check and Test jobs. This is an external runner blocker, not a source diagnostic.\n

@coderabbitai

coderabbitaiBot 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: c6ee3086-b988-4b25-aced-c299a90e62f1

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-actionsgithub-actionsBot 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 threadapps/web/src/components/AgentsPanelV2.tsx Outdated
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch 2 times, most recently from c3a50f8 to 8c6a796CompareJuly 27, 2026 20:52
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from 5187d5b to cde2598CompareJuly 27, 2026 23:03
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch from 8c6a796 to 103b937CompareJuly 27, 2026 23:03
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from cde2598 to fc5b293CompareJuly 28, 2026 15:31
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch from 103b937 to 31adb36CompareJuly 28, 2026 15:31
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from fc5b293 to 85fe8a2CompareJuly 28, 2026 19:27
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch from 31adb36 to b270c47CompareJuly 28, 2026 19:27
Comment threadpackages/client-runtime/src/state/orchestrationV2Subagents.ts Outdated
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from 85fe8a2 to 795eb20CompareJuly 28, 2026 19:46
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch from b270c47 to daf1a88CompareJuly 28, 2026 19:46
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from 795eb20 to 64bf642CompareJuly 28, 2026 20:26
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch 2 times, most recently from 1dce464 to 4c169edCompareJuly 29, 2026 01:19
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from 32cbb3d to c63297eCompareJuly 29, 2026 01:24
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch 2 times, most recently from 70d5111 to c78d0ffCompareJuly 30, 2026 00:00
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from c63297e to 4c70ab1CompareJuly 30, 2026 00:00
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch from c78d0ff to a997806CompareJuly 30, 2026 00:45
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from 4c70ab1 to d453837CompareJuly 30, 2026 00:45
@shivamhwp
shivamhwp marked this pull request as ready for review July 30, 2026 20:04
@macroscopeapp

macroscopeappBot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs human review

New feature introducing workflow visualization panel, inline run cards, and stop controls across server orchestration and web UI layers. The scope includes new components, a new command type (subagent.stop), and contract schema additions - warranting human review for a feature of this breadth.

No code changes detected at 27ecbe1. Prior analysis still applies.

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

@github-actionsgithub-actionsBot added size:XXL 1,000+ changed lines (additions + deletions). and removed size:L 100-499 changed lines (additions + deletions). labels Aug 1, 2026
@shivamhwpshivamhwp changed the title feat(web): add the Agents panel (4/5)feat(web): visualize workflows — agents panel, run cards, stop control (3/4)Aug 1, 2026
Comment threadapps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts
Comment threadapps/server/src/orchestration-v2/Orchestrator.ts Outdated

@macroscopeappmacroscopeappBot 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.

Effect service conventions review of the new stopTask surface (adapter runtime, ProviderTurnControlServiceV2, worker effect). Two findings, both in the error-modelling rules; the rest of the touched Effect code (namespace imports, layer/dependency acquisition, Layer.succeed only in test seams, no ManagedRuntime/runPromise outside boundaries) looks consistent with the conventions.

Posted via Macroscope — Effect Service Conventions

Comment threadapps/server/src/orchestration-v2/ProviderTurnControlService.ts Outdated
Comment threadapps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts Outdated

@cursorcursorBot 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 3 potential issues.

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 c9d6a7c. Configure here.

Comment threadapps/server/src/orchestration-v2/Orchestrator.ts
Comment threadapps/web/src/components/WorkflowRunCardV2.tsx
@shivamhwp

shivamhwp commented Aug 1, 2026

Copy link
Copy Markdown
CollaboratorAuthor

CI follow-up (2026-08-01): all code-bearing checks pass, including Test, Mobile Native Static Analysis, Release Smoke, Macroscope Effect Service Conventions, Macroscope Correctness, and Cursor Bugbot. The Check job was retried twice after its initial failure and hit the same Vite+ runner panic on all three attempts: failed printing to stdout: Resource temporarily unavailable (os error 11). Each attempt reported all 2,639 files correctly formatted before the panic. The top stacked branch at #4664, which contains this exact commit, has a green Check and Test. No source failure is being hidden here; this is recorded as an external CI runner blocker.

— Codex on behalf of shivamhwp

shivamhwpand others added 8 commits August 4, 2026 01:08
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>
The Workflow tool result is the run's only carrier of its disk handles
(script path, transcript dir, run id) and remote session URL. Attach them
to the coordinator's workflow struct so script view, transcripts, and
resume-command affordances have something to read.
The workflow input on updateClaudeSubagentNode becomes a merged partial:
phases arrive on progress snapshots, the name on task_started, and
handles on the tool result, so no writer may clobber the others.
Workflow tool_uses now skip toolCalls like Agent ones do — the
coordinator subagent row is the run's timeline representation, and
registering the tool call too would double-render it. The launch ACK
consequently routes through the subagent branch, which must not
terminalize the coordinator (only task_notification does).
sessionUrl is scheme-restricted to http(s) at the adapter; the replay
fixture carries a hostile javascript: URL to pin the filter.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A workflow previously appeared in the timeline as a bare subagent row per
coordinator and per member — no phases, no live status, and each member
double-reported as its own row. The coordinator's subagent item now
renders as a run card: phase-grouped member rows with live status dots,
a settled/total rollup, token usage, and a Details button that opens the
Agents panel. Members of a present coordinator render nothing (the card
already shows them); members orphaned by a missing coordinator keep
their row rather than disappearing.
Remote runs render their session link instead of member rows, re-checked
against the http(s) allowlist as defense in depth for payloads persisted
before the adapter-side filter. Rows cap at 8, keeping running and
failed agents plus the most recently updated; the remainder defers to
the Agents panel.
Live subagents ride a dedicated context rather than TimelineRowCtx so
progress-tick churn re-renders only subagent rows, not the whole list.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A running workflow previously could only be abandoned by interrupting
the whole run. A new subagent.stop command flows through the durable
command path: the decider validates the subagent is active and carries a
native task ref, records the user's intent as a Stop requested activity
on the subagent row, and queues a process-bound subagent.stop effect.
The effect worker resolves the session and calls the adapter's task stop
— for Claude, the SDK runtime's undocumented stopTask, read behind the
same single-cast convention as workflow_progress.
The provider's own task_notification remains the only terminalizer; the
command records intent, it does not fake a terminal state. A released
session is treated as already stopped (nothing can still be running
under it), while a runtime without task-level stop fails the effect
loudly. Stop effects are process-bound, so recovery cancels them after
process loss like the other session-scoped effects.
The web run card shows Stop only while the coordinator is active, wired
through thread environment commands as thread:stop-subagent.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… retries
Live testing showed every workflow agent wearing a "retry 2" badge on
its first attempt: the SDK reports attempt 1-based once an agent starts,
and the adapter added 1 on top assuming 0-based. Clamp absent or 0 up
to 1 instead of incrementing.
Found by a computer-use pass against a real workflow run; the replay
fixture's hand-authored attempt: 0 normalizes to the same 1 as before.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from b0398e1 to e151f62CompareAugust 3, 2026 19:44
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch from 76a62c7 to 27ecbe1CompareAugust 3, 2026 19:44
@shivamhwp

Copy link
Copy Markdown
CollaboratorAuthor

Converged into #4664, which now carries the full series against the orchestrator-v2 base — the commit history there preserves this PR's slice, and this PR's review record (findings and fix replies) remains the reference for it.

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

Labels

size:XXL1,000+ changed lines (additions + deletions).vouch:trustedPR 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

@shivamhwp
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

feat(web): visualize workflows — agents panel, run cards, stop control (3/4) - #4663

Closed
shivamhwp wants to merge 8 commits into
subagent-obs/03-reusefrom
subagent-obs/04-agents-panel
Closed

feat(web): visualize workflows — agents panel, run cards, stop control (3/4)#4663
shivamhwp wants to merge 8 commits into
subagent-obs/03-reusefrom
subagent-obs/04-agents-panel

Conversation

@shivamhwp

@shivamhwpshivamhwp commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Third of four stacked PRs. Stacked on #4662 — review that first; this diff is against it.

The user-visible half of the series: everything needed to see and control subagents and workflows. This is the "Visualize subagents and workflows" item, and it deliberately ports the best UI ideas from #3650 onto the v2 data model per that PR's close-out.

What's here

The Agents panel. A right-panel tab listing every subagent on the thread — role, model, status, token usage, recent activity, activations per run. Grouping lives in client-runtime so it stays testable: workflow coordinators own their phases, phase status derives from members, members orphaned by a missing coordinator fall back to the flat list rather than disappearing. Coordinators render as cards and are counted without double-reporting member usage.

Inline workflow run cards. A workflow previously appeared as a bare subagent row per coordinator and per member. The coordinator's timeline item now renders as a run card: phase-grouped member rows with live status dots, settled/total rollup, token usage, and a Details button opening the Agents panel. Members of a present coordinator render inside the card only; orphaned members keep their own row. Remote runs render their session link (scheme-restricted to http/https at the adapter and re-checked at the render site). Live subagents ride a dedicated React context so progress-tick churn re-renders only subagent rows, not the whole virtualized timeline.

Workflow run handles. The Workflow tool's launch ACK carries the run's script path, transcript dir, and run id; the adapter attaches them to the coordinator's workflow struct (a merged partial — phases, name, and handles arrive from three different frames and none may clobber the others). Workflow tool_uses now skip toolCalls like Agent ones do, so the run is represented once. These handles are the prerequisite for script view / transcript / resume affordances later.

Stop control. A new subagent.stop command through the durable command path: the decider validates the subagent is active, records "Stop requested" on its row, and queues a process-bound subagent.stop effect; the effect worker resolves the session and calls the adapter's task stop — for Claude, the SDK runtime's undocumented stopTask, read behind the same single-cast convention as workflow_progress. The provider's own task_notification remains the only terminalizer. A released session is treated as already stopped; a runtime without task-level stop fails the effect loudly; recovery cancels pending stop effects after process loss like the other session-scoped effects.

Verified against a live provider

A scripted browser pass against a real Claude session (screenshots on file):

  • The run card appeared with phases and live agent rows; completed at 2/2 agents · 32.7k tok; no duplicate member rows; no Workflow tool-call row; Details opened the panel; state survived a page reload.
  • Stop worked end to end: a 36-agent workflow flipped to Stopped within ~8s of the click; the protocol log shows the outgoing task.stop frame and the SDK's "status":"stopped" notifications coming back.
  • Live testing also caught a real bug, fixed in the last commit: the SDK reports agent attempt 1-based, and the adapter's 0-based assumption stamped every first-attempt agent with a spurious "retry 2" badge.

One observation for the record: after a stop, the parent Claude turn can keep running for minutes (the SDK's turn appears to wait on its dead background task). Our layer settles correctly; this is the known "provider accepts interrupt but never terminalizes" family in the interrupt-hardening TODO, not addressed here.

Testing

Typecheck and lint clean. Web 1,724 passing, client-runtime 539, server orchestration-v2 suite 575. New: run-card component tests, panel derivation tests, stopTask turn-control tests (live/released/unsupported session), extended claude_workflow replay fixture including a hostile javascript: sessionUrl pinned as dropped.


Note

Medium Risk
Touches orchestration command/effect paths and relies on an undocumented Claude SDK stopTask; UI and projection changes are broad but bounded, with explicit failure modes when stop is unsupported or sessions are gone.

Overview
User-facing: A new Agents right-panel tab groups subagents by workflow phase (coordinator cards, member rows, usage and activity). Workflow coordinators in the chat timeline render as inline run cards (phases, member status, Stop/Details) instead of duplicate subagent rows; live subagent projection uses a dedicated context so progress ticks do not re-render the whole timeline.

Stop path:subagent.stop runs through contracts → orchestrator (validates active subagent, emits “Stop requested”, queues effect) → effect worker → ProviderTurnControlService.stopTask → optional adapter stopTask. Claude calls the SDK runtime’s undocumented stopTask by native task id; released sessions are treated as already stopped; missing support fails the effect. Session routing prefers the run’s provider session, then the active thread.

Claude adapter: Workflow run handles (name, runId, scriptPath, transcriptDir, sessionUrl) merge into coordinator workflow without clobbering phases from progress frames; Workflow tool_uses skip toolCalls like Agent; workflow agent attempt is clamped to 1-based SDK reporting; sessionUrl is restricted to http(s) at ingestion.

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

Note

Add agents panel, workflow run cards, and subagent stop control to the chat UI

  • Adds a new AgentsPanelV2 right-panel surface that groups active subagents by workflow phase, shows coordinator cards with token usage and status, and renders direct agents; accessible via a new 'Agents' tab in RightPanelTabs.
  • Introduces WorkflowRunCardV2, an inline timeline card per workflow coordinator showing phase/member rows (capped at 8 with urgency-first ordering), aggregate token usage, run status, and a Stop button.
  • Implements end-to-end subagent stop: new subagent.stop command propagates from client runtime → contracts → orchestrator → EffectWorkerProviderTurnControlServiceClaudeAdapterV2.stopTask.
  • Extends OrchestrationV2Subagent to carry optional workflow run-handle fields (name, runId, scriptPath, transcriptDir, sessionUrl, warning); the Claude adapter extracts these from tool results while deferring settlement to task notifications.
  • Adds state-derivation helpers in orchestrationV2Subagents.ts (deriveOrchestrationV2SubagentPanelState, deriveOrchestrationV2WorkflowRunCard, orchestrationV2WorkflowMemberIds, formatSubagentTokenCount) backed by unit tests.
  • Risk: ClaudeAdapterV2 now calls an undocumented stopTask on the underlying SDK query runtime via a cast; if the SDK does not expose it, the stop fails with a ClaudeAgentSdkQueryRunnerError.

Macroscope summarized 27ecbe1.

Review-fix verification (2026-08-01)

  • c9d6a7c8a makes coordinator usage authoritative, makes Claude stop-without-live-query a warning/no-op, and restricts stop routing to the run-owned or explicitly active provider session.
  • Focused client/server tests pass, including coordinator totals larger than member totals and three provider-session routing cases.
  • Chrome verified the Codex Agents surface, settled counts, per-child usage, aggregate usage, and ordinary-command distinction.

Codex Agents panel

The fresh Claude workflow/Stop rerun could not reach a workflow card because the local Claude OAuth session had expired. The failure was surfaced visibly; current live Stop evidence is therefore blocked rather than claimed.

Claude provider blocker
\n### Final Effect review follow-up (2026-08-01)\n\n- 76a62c7 models the missing Claude stopTask capability as a direct typed failure and reuses an exported ProviderTaskStopError predicate.\n- Focused Claude adapter and provider turn-control tests pass: 52/52. Formatting is clean and the server typecheck exits successfully.\n\n### CI runner note (2026-08-01)\n\n- Test, mobile analysis, release smoke, Macroscope Effect, Macroscope correctness, and Bugbot pass on 76a62c7.\n- The Check job was retried twice after its initial failure. All three attempts reported all 2,639 files formatted, then Vite+ panicked while writing existing lint warnings to stdout with OS error 11 (resource temporarily unavailable).\n- The top stacked branch in #4664 contains this commit and has green Check and Test jobs. This is an external runner blocker, not a source diagnostic.\n

@coderabbitai

coderabbitaiBot 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: c6ee3086-b988-4b25-aced-c299a90e62f1

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-actionsgithub-actionsBot 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 threadapps/web/src/components/AgentsPanelV2.tsx Outdated
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch 2 times, most recently from c3a50f8 to 8c6a796CompareJuly 27, 2026 20:52
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from 5187d5b to cde2598CompareJuly 27, 2026 23:03
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch from 8c6a796 to 103b937CompareJuly 27, 2026 23:03
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from cde2598 to fc5b293CompareJuly 28, 2026 15:31
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch from 103b937 to 31adb36CompareJuly 28, 2026 15:31
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from fc5b293 to 85fe8a2CompareJuly 28, 2026 19:27
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch from 31adb36 to b270c47CompareJuly 28, 2026 19:27
Comment threadpackages/client-runtime/src/state/orchestrationV2Subagents.ts Outdated
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from 85fe8a2 to 795eb20CompareJuly 28, 2026 19:46
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch from b270c47 to daf1a88CompareJuly 28, 2026 19:46
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from 795eb20 to 64bf642CompareJuly 28, 2026 20:26
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch 2 times, most recently from 1dce464 to 4c169edCompareJuly 29, 2026 01:19
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from 32cbb3d to c63297eCompareJuly 29, 2026 01:24
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch 2 times, most recently from 70d5111 to c78d0ffCompareJuly 30, 2026 00:00
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from c63297e to 4c70ab1CompareJuly 30, 2026 00:00
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch from c78d0ff to a997806CompareJuly 30, 2026 00:45
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from 4c70ab1 to d453837CompareJuly 30, 2026 00:45
@shivamhwp
shivamhwp marked this pull request as ready for review July 30, 2026 20:04
@macroscopeapp

macroscopeappBot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs human review

New feature introducing workflow visualization panel, inline run cards, and stop controls across server orchestration and web UI layers. The scope includes new components, a new command type (subagent.stop), and contract schema additions - warranting human review for a feature of this breadth.

No code changes detected at 27ecbe1. Prior analysis still applies.

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

@github-actionsgithub-actionsBot added size:XXL 1,000+ changed lines (additions + deletions). and removed size:L 100-499 changed lines (additions + deletions). labels Aug 1, 2026
@shivamhwpshivamhwp changed the title feat(web): add the Agents panel (4/5)feat(web): visualize workflows — agents panel, run cards, stop control (3/4)Aug 1, 2026
Comment threadapps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts
Comment threadapps/server/src/orchestration-v2/Orchestrator.ts Outdated

@macroscopeappmacroscopeappBot 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.

Effect service conventions review of the new stopTask surface (adapter runtime, ProviderTurnControlServiceV2, worker effect). Two findings, both in the error-modelling rules; the rest of the touched Effect code (namespace imports, layer/dependency acquisition, Layer.succeed only in test seams, no ManagedRuntime/runPromise outside boundaries) looks consistent with the conventions.

Posted via Macroscope — Effect Service Conventions

Comment threadapps/server/src/orchestration-v2/ProviderTurnControlService.ts Outdated
Comment threadapps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts Outdated

@cursorcursorBot 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 3 potential issues.

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 c9d6a7c. Configure here.

Comment threadapps/server/src/orchestration-v2/Orchestrator.ts
Comment threadapps/web/src/components/WorkflowRunCardV2.tsx
@shivamhwp

shivamhwp commented Aug 1, 2026

Copy link
Copy Markdown
CollaboratorAuthor

CI follow-up (2026-08-01): all code-bearing checks pass, including Test, Mobile Native Static Analysis, Release Smoke, Macroscope Effect Service Conventions, Macroscope Correctness, and Cursor Bugbot. The Check job was retried twice after its initial failure and hit the same Vite+ runner panic on all three attempts: failed printing to stdout: Resource temporarily unavailable (os error 11). Each attempt reported all 2,639 files correctly formatted before the panic. The top stacked branch at #4664, which contains this exact commit, has a green Check and Test. No source failure is being hidden here; this is recorded as an external CI runner blocker.

— Codex on behalf of shivamhwp

shivamhwpand others added 8 commits August 4, 2026 01:08
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>
The Workflow tool result is the run's only carrier of its disk handles
(script path, transcript dir, run id) and remote session URL. Attach them
to the coordinator's workflow struct so script view, transcripts, and
resume-command affordances have something to read.
The workflow input on updateClaudeSubagentNode becomes a merged partial:
phases arrive on progress snapshots, the name on task_started, and
handles on the tool result, so no writer may clobber the others.
Workflow tool_uses now skip toolCalls like Agent ones do — the
coordinator subagent row is the run's timeline representation, and
registering the tool call too would double-render it. The launch ACK
consequently routes through the subagent branch, which must not
terminalize the coordinator (only task_notification does).
sessionUrl is scheme-restricted to http(s) at the adapter; the replay
fixture carries a hostile javascript: URL to pin the filter.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A workflow previously appeared in the timeline as a bare subagent row per
coordinator and per member — no phases, no live status, and each member
double-reported as its own row. The coordinator's subagent item now
renders as a run card: phase-grouped member rows with live status dots,
a settled/total rollup, token usage, and a Details button that opens the
Agents panel. Members of a present coordinator render nothing (the card
already shows them); members orphaned by a missing coordinator keep
their row rather than disappearing.
Remote runs render their session link instead of member rows, re-checked
against the http(s) allowlist as defense in depth for payloads persisted
before the adapter-side filter. Rows cap at 8, keeping running and
failed agents plus the most recently updated; the remainder defers to
the Agents panel.
Live subagents ride a dedicated context rather than TimelineRowCtx so
progress-tick churn re-renders only subagent rows, not the whole list.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A running workflow previously could only be abandoned by interrupting
the whole run. A new subagent.stop command flows through the durable
command path: the decider validates the subagent is active and carries a
native task ref, records the user's intent as a Stop requested activity
on the subagent row, and queues a process-bound subagent.stop effect.
The effect worker resolves the session and calls the adapter's task stop
— for Claude, the SDK runtime's undocumented stopTask, read behind the
same single-cast convention as workflow_progress.
The provider's own task_notification remains the only terminalizer; the
command records intent, it does not fake a terminal state. A released
session is treated as already stopped (nothing can still be running
under it), while a runtime without task-level stop fails the effect
loudly. Stop effects are process-bound, so recovery cancels them after
process loss like the other session-scoped effects.
The web run card shows Stop only while the coordinator is active, wired
through thread environment commands as thread:stop-subagent.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… retries
Live testing showed every workflow agent wearing a "retry 2" badge on
its first attempt: the SDK reports attempt 1-based once an agent starts,
and the adapter added 1 on top assuming 0-based. Clamp absent or 0 up
to 1 instead of incrementing.
Found by a computer-use pass against a real workflow run; the replay
fixture's hand-authored attempt: 0 normalizes to the same 1 as before.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@shivamhwp
shivamhwpforce-pushed the subagent-obs/03-reuse branch from b0398e1 to e151f62CompareAugust 3, 2026 19:44
@shivamhwp
shivamhwpforce-pushed the subagent-obs/04-agents-panel branch from 76a62c7 to 27ecbe1CompareAugust 3, 2026 19:44
@shivamhwp

Copy link
Copy Markdown
CollaboratorAuthor

Converged into #4664, which now carries the full series against the orchestrator-v2 base — the commit history there preserves this PR's slice, and this PR's review record (findings and fix replies) remains the reference for it.

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

Labels

size:XXL1,000+ changed lines (additions + deletions).vouch:trustedPR 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

@shivamhwp