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 into
subagent-obs/03-reuse fromsubagent-obs/04-agents-panelopened View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
- apps/web/src/components/AgentsPanelV2.tsx lines 72 to 72OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +52,21 @@52+ return [`Run ${activation.ordinal}`, activation.status, usage]53+ .filter((value): value is string => value !== null)54+ .join(" · ");55+};56+57+const keyedActivities = (agent: OrchestrationV2Subagent) => {58+ const occurrences = new Map<string, number>();59+ return agent.recentActivity.map((activity) => {60+ const base = `${DateTime.formatIso(activity.at)}:${activity.summary}`;61+ const occurrence = (occurrences.get(base) ?? 0) + 1;62+ occurrences.set(base, occurrence);63+ return { activity, key: `${base}:${occurrence}` };64+ });65+};66+67+function AgentCard(props: {68+ agent: OrchestrationV2Subagent;69+ activations: ReadonlyArray<OrchestrationV2SubagentActivation>;70+}) {71+ const { agent } = props;72+ const detail = agent.progress?.trim() || agent.result?.trim() || agent.prompt.trim();
- packages/client-runtime/src/state/orchestrationV2Subagents.ts lines 38 to 43OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +23,21 @@23+ ReadonlyArray<OrchestrationV2SubagentActivation>24+ >;25+ readonly activeCount: number;26+ readonly waitingCount: number;27+ readonly settledCount: number;28+ readonly totalTokens: number | null;29+}30+31+export const isSettledOrchestrationV2Subagent = (agent: OrchestrationV2Subagent) =>32+ agent.status === "idle" ||33+ agent.status === "completed" ||34+ agent.status === "failed" ||35+ agent.status === "cancelled" ||36+ agent.status === "interrupted";37+38+const phaseStatus = (agents: ReadonlyArray<OrchestrationV2Subagent>) =>39+ agents.length === 040+ ? ("pending" as const)41+ : agents.every(isSettledOrchestrationV2Subagent)42+ ? ("done" as const)43+ : ("running" as const);
- packages/client-runtime/src/state/orchestrationV2Subagents.ts line 136Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -0,0 +120,21 @@120+ // but omits per-agent tokens.121+ return memberTotal >= agent.usage.totalTokens ? [] : [agent.usage.totalTokens - memberTotal];122+ });123+ // Count the workers, plus any coordinator that has no members yet. A124+ // coordinator with members is represented by them and would double-count;125+ // one without is the only row on the thread, and omitting it reported126+ // "0 active" while a workflow was visibly running.127+ const counted = input.subagents.filter(128+ (agent) => agent.kind !== "workflow" || !memberTotalsByWorkflow.has(agent.id),129+ );130+ return {131+ groups,132+ activationsBySubagentId,133+ activeCount: counted.filter((agent) => agent.status === "pending" || agent.status === "running")134+ .length,135+ waitingCount: counted.filter((agent) => agent.status === "waiting").length,136+ settledCount: counted.filter(isSettledOrchestrationV2Subagent).length,137+ totalTokens:138+ reportedUsage.length === 0139+ ? null140+ : reportedUsage.reduce((total, tokens) => total + tokens, 0),
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:L
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XXL
shivamhwp(GitHub profile, opens in a new tab) changed the title
- apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts line 4494Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -4357,3 +4479,13 @@43574479 startTurn,43584480 steerTurn,43594481 interruptTurn,4482+ stopTask: Effect.fn("ClaudeAdapterV2.stopTask")(function* (stopInput: {4483+ readonly nativeTaskId: string;4484+ }) {4485+ const existing = yield* Ref.get(queryContext);4486+ if (existing === null) {4487+ return yield* new ProviderAdapterProtocolError({4488+ driver: CLAUDE_PROVIDER,4489+ detail: `Claude provider session ${input.providerSessionId} has no live query to stop task ${stopInput.nativeTaskId}.`,4490+ });4491+ }apps/server/src/orchestration-v2/Orchestrator.ts line 5371OutdatedResolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -5314,0 +5351,21 @@5351+ commandId: command.commandId,5352+ commandType: command.type,5353+ cause: `Subagent ${command.subagentId} has no native task reference to stop.`,5354+ });5355+ }5356+ // The stop call goes through the session the subagent's run executes5357+ // under; a workflow that outlived its launch run falls back to the5358+ // thread's bound session, which owns background tasks between turns.5359+ const run =5360+ subagent.runId === null5361+ ? undefined5362+ : projection.runs.find((candidate) => candidate.id === subagent.runId);5363+ const runProviderThread =5364+ run?.providerThreadId === null5365+ ? undefined5366+ : projection.providerThreads.find((candidate) => candidate.id === run?.providerThreadId);5367+ const providerSessionId =5368+ runProviderThread?.providerSessionId ??5369+ projection.providerThreads.find((candidate) => candidate.providerSessionId !== null)5370+ ?.providerSessionId ??5371+ null;
- apps/server/src/orchestration-v2/ProviderTurnControlService.ts lines 293 to 294OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -250,0 +274,21 @@274+ {275+ threadId: input.threadId,276+ providerSessionId: input.providerSessionId,277+ nativeTaskId: input.nativeTaskId,278+ },279+ );280+ return;281+ }282+ const stop = session.value.stopTask;283+ if (stop === undefined) {284+ return yield* new ProviderTaskStopError({285+ threadId: input.threadId,286+ providerSessionId: input.providerSessionId,287+ nativeTaskId: input.nativeTaskId,288+ cause: "The provider runtime for this session does not support stopping tasks.",289+ });290+ }291+ yield* stop({ nativeTaskId: input.nativeTaskId });292+ }).pipe(293+ Effect.mapError((cause) =>294+ Schema.is(ProviderTaskStopError)(cause)apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts lines 606 to 610OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -585,3 +594,17 @@585594 }),586595 ),587596 ),597+ stopTask: (taskId) =>598+ Effect.tryPromise({599+ try: () => {600+ // stopTask is deliberate wire surface (the CLI's own601+ // /workflows view stops through it) but absent from the602+ // published SDK types — this cast is the single place the603+ // undocumented method is read.604+ const stop = (queryRuntime as { stopTask?: (taskId: string) => Promise<void> })605+ .stopTask;606+ if (stop === undefined) {607+ throw new Error(608+ "The Claude SDK runtime for this session does not expose stopTask.",609+ );610+ }
- apps/server/src/orchestration-v2/Orchestrator.ts line 5421Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -5314,0 +5401,21 @@5401+ ...(subagent.runId === null ? {} : { runId: subagent.runId }),5402+ nodeId: subagent.id,5403+ driver: subagent.driver,5404+ occurredAt: now,5405+ payload: {5406+ ...subagent,5407+ recentActivity: appendSubagentActivity(subagent.recentActivity, "Stop requested", now),5408+ updatedAt: now,5409+ },5410+ });5411+ yield* Ref.update(effects, (existing) => [5412+ ...existing,5413+ {5414+ id: `effect:${command.commandId}:subagent.stop:${subagent.id}`,5415+ commandId: command.commandId,5416+ threadId: command.threadId,5417+ request: {5418+ type: "subagent.stop",5419+ providerSessionId,5420+ nativeTaskId,5421+ },apps/web/src/components/WorkflowRunCardV2.tsx line 260Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -0,0 +240,21 @@240+ )}241+ </div>242+ </div>243+244+ {remote ? (245+ sessionUrl === undefined ? (246+ <p className="mt-1.5 px-0.5 text-[12px] leading-5 text-muted-foreground/70">247+ Running in the cloud248+ </p>249+ ) : (250+ <a251+ href={sessionUrl}252+ target="_blank"253+ rel="noopener noreferrer"254+ className="mt-1.5 flex items-center gap-1.5 rounded-md px-0.5 py-0.5 text-[12px] leading-5 text-foreground/80 hover:bg-accent/20 hover:text-foreground"255+ >256+ <ExternalLinkIcon className="size-3.5 shrink-0 text-muted-foreground" />257+ Running in the cloud — open session258+ </a>259+ )260+ ) : members.length > 0 ? (packages/client-runtime/src/state/orchestrationV2Subagents.ts line 131Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -0,0 +111,21 @@111+ );112+ const reportedUsage = input.subagents.flatMap((agent) => {113+ if (agent.usage === null) return [];114+ const workflowId = agent.workflowMembership?.workflowSubagentId;115+ return workflowId !== undefined && workflowIdsWithReportedUsage.has(workflowId)116+ ? []117+ : [agent.usage.totalTokens];118+ });119+ // Count the workers, plus any coordinator that has no members yet. A120+ // coordinator with members is represented by them and would double-count;121+ // one without is the only row on the thread, and omitting it reported122+ // "0 active" while a workflow was visibly running.123+ const counted = input.subagents.filter(124+ (agent) => agent.kind !== "workflow" || !memberTotalsByWorkflow.has(agent.id),125+ );126+ return {127+ groups,128+ activationsBySubagentId,129+ activeCount: counted.filter((agent) => agent.status === "pending" || agent.status === "running")130+ .length,131+ waitingCount: counted.filter((agent) => agent.status === "waiting").length,
shivamhwp(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.

\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 

Important
Review skipped#
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID:
c6ee3086-b988-4b25-aced-c299a90e62f1You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
✨ Finishing Touches
🧪 Generate unit tests (beta)
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