Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): stop counting a workflow coordinator as a working agent #6672

MergedRishet11(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/6672/headmerged by juliusmarminge View on GitHub

What Changed

Running a workflow made the background-work banner claim one more agent was working than actually was. With a workflow that had two members and one of them finished, the banner still read "2 agents working in the background" while only one was. The "N working" count in the Agents panel footer was off by the same one.

The extra agent was the workflow coordinator. It is the row that represents the workflow itself, and it stays running for as long as the workflow runs, so it was tallied alongside the members it stands for.

The coordinator is now skipped when counting agents by status, so the banner reports the members that are actually doing work.

Why

deriveAgentPanelModel was already skipping these coordinators when summing token usage, with the comment "Workflow coordinators aggregate member usage upstream in some providers; avoid double counting by only summing leaf agents when members exist." The same reasoning applies to the status tally, it just was not applied there.

Rather than repeat that condition, this hoists it to the top of the loop as a single continue, so a coordinator that stands in for members is left out of both the counts and the token sum. The net effect on tokens is unchanged.

A coordinator with no members yet is still counted, as before. It is not standing in for anything at that point.

Note on an existing test

One assertion had to change. It checked that the four status counts add up to the number of agents in the roster, and its comment read "wf-1 coordinator + member 1 running", so it was asserting the behaviour this fixes. It now expects the coordinator to be excluded.

Two tests were added: one for the reported case (the banner count), and one for a finished workflow, so the matching change to the "N settled" footer is covered rather than assumed.

UI Changes

n/a - no layout or styling change. Only the number in the banner and the panel footer differ, and only when a workflow is running.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes (n/a)
  • I included a video for animation/interaction changes (n/a)

Verification

vp test run packages/client-runtime/src/state/subagentRuntime.test.ts   # 48 passed
vp run --filter @t3tools/client-runtime typecheck                       # exit 0, no errors
vp lint packages/client-runtime/src/state/subagentRuntime.ts packages/client-runtime/src/state/subagentRuntime.test.ts
vp fmt --check <same two files>

Removing the new continue makes both new tests fail with expected 2 to be 1, which is the inflated count from the report.

Consumers checked: ChatView (banner) and AgentsPanel (footer) read these counts for display only. The per-phase activeCount / settledCount in AgentsPanel come from a different object and are untouched. apps/mobile does not use deriveAgentPanelModel; its Live Activity count comes from a server-side aggregate, which is worth a separate look and is not changed here.

Fixes #5807

Implemented with Claude Opus 5 via Claude Code.


Note

Low Risk Small display-only logic change in deriveAgentPanelModel; no auth, data, or API surface changes.

Overview Fixes inflated “N agents working” banner and Agents panel footer counts when a workflow is active.

deriveAgentPanelModel now skips workflow coordinators that have members in the status tally loop—the coordinator stays running for the whole workflow but is a container, not an extra worker. The same early continue replaces the separate token-sum guard; token totals are unchanged.

Coordinators with no members are still counted. Tests lock in liveCount, settledCount, and the bucket-sum invariant (roster.length - 1 when a memberful coordinator is present).

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit b38f9d044912365a7bb1aa40add976698a3aadb3. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

Note

Stop counting workflow coordinators as working agents in deriveAgentPanelModel

Workflow coordinator agents that have members act as containers, not workers, and were incorrectly included in running/waiting/idle/settled tallies and liveCount. The aggregation loop in subagentRuntime.ts now skips coordinators with members when computing status buckets and usage totals, so counts reflect only leaf agents and memberless coordinators.

Macroscope summarized b38f9d0.
    1. Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

    2. 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: fd1a9b72-5d41-4480-ae66-a4df2f3c9e15

      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

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

    4. Approvability

      Verdict: Approved b38f9d0

      This is a straightforward bug fix that prevents workflow coordinators from being double-counted in the agent panel display. The change is self-contained, clearly commented, and includes comprehensive unit tests.

      You can customize Macroscope's approvability policy. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    5. juliusmarminge merged this9bdd912

    6. juliusmarminge closed this

Sign in to join this conversation.