fix(client-runtime): count workflows between phases - #8749
yashranaway wants to merge 2 commits into
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Warning Your free Security trial is over. An organization admin can activate Security or dismiss this notice. Comment |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 38efa7c. Configure here.
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a small, localized client-runtime bug fix that corrects workflow liveness counts between phases while preserving member accounting and token totals. Targeted tests cover both the corrected case and the idle-member case, with no product-default or sensitive-area changes. You can add or adjust custom eligibility rules. Learn more. |
|
Verified locally on pr-8749 (770f539) as CDVolvik — no push. Checked out fix/workflow-phase-gap-live-count and inspected deriveAgentPanelModel in subagentRuntime.ts:828. The new standsInForMembers guard only hides the coordinator when members still need representation, so an active coordinator with all members terminal is counted as running/live between phases — fixes the zero-agents gap from #8720 without reintroducing #5807. Token aggregation now excludes workflow usage whenever members exist, avoiding double-count. Tests: pnpm exec vitest run packages/client-runtime/src/state/subagentRuntime.test.ts — 51 passed (2 new: between-phases and idle-member). Revert check: checking out main runtime with the PR test file fails counts a running workflow coordinator between phases (1 failed | 50 passed); restoring the PR file passes again. Low-risk, focused change. LGTM. |

What Changed
Why
A workflow remains active while its coordinator prepares the next phase, but the shared rollup reported zero live agents during that gap.
Closes #8720
Testing
Checklist
Model: GPT-5.6 Sol
Harness: Codex in T3 Code
Note
Low Risk
Localized change to agent panel counting in client-runtime; callers of
deriveAgentPanelModelmay see different live/running counts during workflow phase transitions.Overview
Fixes the agent panel rollup so a workflow coordinator is counted as live when the current phase’s members are all settled but the workflow is still active (gap before the next phase). Previously, coordinators with members were always omitted from
runningCount/liveCount, so the UI could show zero working agents while the coordinator was still running.deriveAgentPanelModelnow treats a coordinator as standing in for its members (and skips it in status buckets) only when members still need representation—not when the coordinator is active and every member is terminal. Token totals still exclude workflow rows that have members to avoid double-counting aggregated usage.Regression tests cover the between-phases case and confirm the coordinator stays hidden when a phase member is idle.
Reviewed by Cursor Bugbot for commit 770f539. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Fix
deriveAgentPanelModelto count workflow coordinators between phasestotalTokensnow excludes workflow coordinator usage whenever it has members, preventing double-counting; coordinators with no members still contribute their own usagederiveAgentPanelModelsuite asserting counting invariants for coordinators between phases and when members are idlerunningCount,idleCount,settledCount, andliveCountin subagentRuntime.ts change semantics for coordinators with members; verify consumers of these tallies handle the between-phase inclusionMacroscope summarized 770f539.