Skip to content
Source
Sign inSign up
pingdotgg/t3code

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

Closedshivamhwp(GitHub profile, opens in a new tab)wants to merge 8 commits intosubagent-obs/03-reuse fromsubagent-obs/04-agents-panelopened View on GitHub

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](https://cursor.com/bugbot) for commit 76a62c7061866f49f78b5582393a3cf9b0c2dd34. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

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 → EffectWorker → ProviderTurnControlService → ClaudeAdapterV2.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- 76a62c706 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 76a62c706.\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

    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      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.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    3. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      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](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. shivamhwp(GitHub profile, opens in a new tab) changed the title

    5. 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
    6. 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](https://www.cursor.com/dashboard/bugbot). Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit c9d6a7c8af0829890ca9bdafef1ac0be9fbf7037. Configure [here](https://www.cursor.com/dashboard/bugbot).
    7. shivamhwp(GitHub profile, opens in a new tab)commented

      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

    8. 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 in to join this conversation.