Skip to content

fix(client-runtime): count workflows between phases - #8749

Open
yashranaway wants to merge 2 commits into
pingdotgg:mainfrom
yashranaway:fix/workflow-phase-gap-live-count
Open

yashranaway wants to merge 2 commits into
pingdotgg:mainfrom
yashranaway:fix/workflow-phase-gap-live-count

Conversation

@yashranaway

@yashranaway yashranaway commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

What Changed

  • Count a live workflow coordinator when all current phase members have settled.
  • Keep workflow coordinator token usage excluded when members exist.
  • Add coverage for the gap between workflow phases.

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

  • pnpm exec vp test run packages/client-runtime/src/state/subagentRuntime.test.ts
  • pnpm exec vp run --filter @t3tools/client-runtime typecheck
  • pnpm exec vp lint packages/client-runtime/src/state/subagentRuntime.ts packages/client-runtime/src/state/subagentRuntime.test.ts

Checklist

  • One focused behavior change
  • Focused regression coverage
  • Formatting and lint pass

Model: GPT-5.6 Sol
Harness: Codex in T3 Code


Note

Low Risk
Localized change to agent panel counting in client-runtime; callers of deriveAgentPanelModel may 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.

deriveAgentPanelModel now 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 deriveAgentPanelModel to count workflow coordinators between phases

  • Workflow coordinators with members are now counted as running/live when active and all members are terminal (e.g. between phases), and excluded when any member is non-terminal
  • totalTokens now excludes workflow coordinator usage whenever it has members, preventing double-counting; coordinators with no members still contribute their own usage
  • Adds tests in deriveAgentPanelModel suite asserting counting invariants for coordinators between phases and when members are idle
  • Behavioral Change: runningCount, idleCount, settledCount, and liveCount in subagentRuntime.ts change semantics for coordinators with members; verify consumers of these tallies handle the between-phase inclusion

Macroscope summarized 770f539.

@coderabbitai

coderabbitai Bot commented Aug 30, 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: c29483f9-6a9d-465b-9786-f223ba8856d8

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

Warning

Your free Security trial is over. An organization admin can activate Security or dismiss this notice.


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

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Aug 30, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 38efa7c. Configure here.

Comment thread packages/client-runtime/src/state/subagentRuntime.ts
@macroscopeapp

macroscopeapp Bot commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 770f539

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.

@CDVolvik

Copy link
Copy Markdown
Contributor

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.

This branch has not been deployed

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

Labels

size:S 10-29 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Workflow between phases reports zero working agents — banner, panel footer and badge all read as finished

2 participants