Skip to content

fix(chat): count only agents as workers; keep shell commands out of the workers tray - #50464

Merged
AmethystLiang merged 3 commits into
mainfrom
AmethystLiang/workers-tray-commands
Nov 27, 2026
Merged

AmethystLiang merged 3 commits into
mainfrom
AmethystLiang/workers-tray-commands

Conversation

@AmethystLiang

@AmethystLiang AmethystLiang commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

The "Workers" pill above the message box counted plain shell commands as workers. Now it counts only agents. Commands the agent is waiting on stay in the chat, and commands running in the background get their own "Background commands" group with their own count and Stop.

Files Added Deleted Net
Test 8 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1362 $\color{#cf222e}{\Huge{\mathbf{−}}}$​18 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1344
Prod 31 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1178 $\color{#cf222e}{\Huge{\mathbf{−}}}$​196 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​982

What Changed

Before: a single Bash call the agent was waiting on showed up in the floating tray as a worker row with a spinner, and the pill said "1 worker". Background commands, monitors and workflows were all counted as workers.

After:

  • Commands the agent waits on never reach the tray, for any provider. They stay in their transcript tool row. A command shows up once it moves to the background (timeout, Ctrl+B, steer), read from Claude's task update or its background-task list.
  • "Workers" counts orchestration workers and subagents only. Background commands, monitors, workflows and unclassified tasks are listed below them under "Background commands", keep their Stop (including from a remote chat), and are never counted as workers.
    • Pill: "2 workers", "1 background command" (terminal icon), or "2 workers · 1 command"; the spoken name always names both in full.
    • Open card: agents first, then the labelled command group; each group is its own named group for screen readers; arrow keys move straight from the last worker to the first command.
    • Command rows are one mono line; the full command is in the tooltip and the details dialog.
  • Stop all moves to the card's footer and says what it stops. It never stops orchestration workers and names no target, so beside them it reads "Stop subagents and commands", with "Workers keep running" as its description; with no workers listed it stays "Stop all". When the footer is too narrow for both labels, the bulk Clear steps aside (each failed row keeps its own Clear) and the Stop label is never cut. A footer action that disappears while focused hands focus to the pill.
  • Lost end events stay visible. If a command the agent was waiting on is still reported running after its tool call returned and the turn ended (or after its subagent ended), it shows under Background commands with an unknown state and a Stop instead of staying hidden.
  • A failed foreground command is no longer kept as a failed tray row (its transcript row shows the failure), and a command, monitor or workflow row's details say "Command output is not available yet" rather than "Worker result unavailable" while output is pending.

Why

A shell command is not an agent, and counting it as one made the pill misleading. Checked against how comparable products handle this: commands the agent waits on stay inline in the conversation, background shells are a separately named list with their own Stop, and only agents count as agents.

Root cause had two parts: the shared child-work projection only hid Codex foreground commands, so every Claude Bash call (which Claude reports as a task) reached the tray; and the tray counted every row of any kind as a worker. Keeping background commands in the same card (rather than dropping them or adding a second pill) keeps their Stop reachable from remote chats without a second floating control.

Linked Issue

Internal report; no public issue.

Visual Proof

Fixture renders with made-up data (left: before, right: after).

Open card with workers and background commands:

open card, before and after

Folded pill, workers and commands:

folded pill mixed, before and after

Folded pill, background commands only:

folded pill commands only, before and after

Testing

  • I manually tested these changes locally (component fixtures in headless Chromium, light and dark, 320 / 420 px; keyboard across groups)
  • Automated tests added/updated
  • Every added test fails without this change and avoids the test anti-patterns, except the guards listed below

Tests that fail without this change: the projection test (foreground commands hidden for every provider), the Claude decoder tests for background-roster promotion, survivors after the turn/subagent ends, the returned-call mark, journal-attributed owners and self-ownership, the failed-foreground retention test, and the tray tests for counts, chip/header/region names, grouping, held order, Stop all label, footer focus, Clear label, spoken-title cap, focus across group changes and held-gesture names.

Guards that also pass on main (kept on purpose): the captured Claude frame sequences (short foreground command; timeout auto-background), the basic foreground/background residency tests, and tray cases for agents only, no rows, a single group, and a command row's Stop routing.

Focus and held-name tests, with the tray component files reverted to the previous version of this branch, then with this change:

× keeps focus on the same row when a second group appears or leaves
× keeps focus on a command row when the first worker arrives
× keeps focus on a command row’s Stop when the last worker leaves
× keeps naming a held commands-only card by its rows while the live roster empties
× keeps a held folded commands-only chip’s terminal mark and name
× keeps a held mixed chip’s full spoken count
Tests  6 failed | 2 passed (guards)

✓ all 8 (same file, this change)

tests/tools/worker-dock-rendered is run by hand against the fixture server; it is not part of CI. This change moves its Stop all check to the footer and adds grouped-tray checks (both groups and their names, ArrowDown from the last worker to the first command, the commands-only chip, the footer at 320/420 px, and a 35-row virtualized mixed card crossing the groups by keyboard). Result on this branch:

83 passed, 1 failed
FAIL a detail read held across a roster change is not asked again, and a fresh one follows a stale reply  (fails the same on main without this change)

(An earlier run under heavy machine load also timed out once on "sits at the start just above the queue (320px, light)"; it passes when re-run alone and in the latest full run.)

Typecheck (web, node) and lint pass.

Performance

None worth measuring. The tray does one extra pass over its listed rows per render to split them into two groups (bounded by the visible roster, already virtualized past 30 rows), and the Claude decoder does one pass over its live tasks on each tool result and turn end (a handful of entries). No new IPC, polling, subprocesses or disk access.

Risk

Level: Medium

The riskiest part is the Claude task decoder: if Claude ever reported a background move only in a way the decoder misses, that command would stay hidden until it ends. The roster and the task update both promote it, and a command still running after its call returned is surfaced rather than hidden. An older paired host still sends its foreground Claude commands; a new client shows them under Background commands, never as workers. Back out with a plain revert.

Review

…he workers tray

The floating workers tray listed a running foreground shell command as a worker and the chip said
"1 worker". Now:

- Foreground commands (any provider's ordinary tool calls) never reach the tray; they stay in the
  transcript. A command moved to the background (timeout, Ctrl+B, steer) shows up once it moves,
  read from Claude's task patch or its background roster.
- "Workers" counts orchestration workers and subagents only. Background commands, monitors,
  workflows and unclassified tasks are listed in their own "Background commands" group, keep their
  Stop (including from a remote chat) and are never counted as workers.
- Stop all moves to the card's footer and names what it stops; it never stops orchestration
  workers and never understates the provider stop.
- A foreground command still live after the call that waited on it returned is shown as background
  work with an unverified state and a Stop, instead of staying hidden.
- A failed foreground command is not kept as a tray failure; monitor and workflow rows open their
  run details.
@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Claude child-work decoding now tracks foreground commands that continue after a turn and marks them unverifiable until usable progress arrives. Child-work views exclude foreground commands across providers. The worker dock groups and counts background commands separately from workers, adds scoped stop and clear controls, and updates accessible labels and translations. Tests and rendered checks cover command residency, grouping, focus behavior, and footer layouts.

Merge Risk: Minimal · up to a59ca

The tray now separates workers from background commands and keeps keyboard focus in the chat when footer actions disappear. No unresolved defects remain, so the change is ready to merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: only agents count as workers, and shell commands are kept out of the workers tray. It also has the fix(chat) prefix. The title is concise and specific, and it matches …
Description check Passed The description follows the repository template. It covers ELI5, What Changed, Why, Visual Proof, Testing, Performance, Risk, and the checklist. The Risk level is set to Medium with a rollback method.…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: only agents count as workers, and shell commands are kept out of the workers tray. It also has the fix(chat) prefix. The title is concise and specific, and it matches the changeset, which splits background commands into their own group and keeps foreground commands out of the tray.

Full details: Description check

Explanation

The description follows the repository template. It covers ELI5, What Changed, Why, Visual Proof, Testing, Performance, Risk, and the checklist. The Risk level is set to Medium with a rollback method. The Linked Issue section says 'Internal report; no public issue,' which does not meet the template's rule for an issue link, but the author is likely an internal maintainer, so the special case may apply. The AI Disclosure and Agent skill upstream sections are left unfilled. Those sections are optional or conditional in the template, so the description is mostly complete.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 882da6e4-b48f-46c7-b605-74e929cc0a07
Commits

Reviewing files that changed from the base of the PR and between 993e90b and a59ca03.

Files selected for processing: 3

  • src/renderer/src/components/native-chat/tools/tasks/dock/WorkerDockRoster.tsx
  • src/renderer/src/components/native-chat/tools/tasks/dock/use-worker-dock-footer-focus.ts
  • src/renderer/src/components/native-chat/tools/tasks/dock/worker-dock-command-group.test.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.

@coderabbitai coderabbitai 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.

Actionable comments posted: 3

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 012004de-1c03-43d0-87e3-aaa9fae475f2
Commits

Reviewing files that changed from the base of the PR and between 19dd835 and 7580c36.

Files selected for processing: 38

  • src/main/claude/child-work/claude-child-work-decoder.ts
  • src/main/claude/child-work/claude-child-work-evidence.ts
  • src/main/claude/child-work/claude-child-work-residency.test.ts
  • src/main/claude/child-work/claude-child-work-roster.ts
  • src/main/runtime/orchestration/dock/worker-dock-provider-failures.test.ts
  • src/renderer/src/components/native-chat/tools/tasks/NativeChatBackgroundTasksStatus.test.tsx
  • src/renderer/src/components/native-chat/tools/tasks/NativeChatBackgroundTasksStatus.tsx
  • src/renderer/src/components/native-chat/tools/tasks/dock/WorkerDockCardFooter.tsx
  • src/renderer/src/components/native-chat/tools/tasks/dock/WorkerDockCommandGroup.fixture.tsx
  • src/renderer/src/components/native-chat/tools/tasks/dock/WorkerDockGlyph.tsx
  • src/renderer/src/components/native-chat/tools/tasks/dock/WorkerDockGroupedRows.tsx
  • src/renderer/src/components/native-chat/tools/tasks/dock/WorkerDockPill.tsx
  • src/renderer/src/components/native-chat/tools/tasks/dock/WorkerDockProviderDetailsDialog.tsx
  • src/renderer/src/components/native-chat/tools/tasks/dock/WorkerDockRoster.tsx
  • src/renderer/src/components/native-chat/tools/tasks/dock/WorkerDockRow.tsx
  • src/renderer/src/components/native-chat/tools/tasks/dock/WorkerDockRowAction.tsx
  • src/renderer/src/components/native-chat/tools/tasks/dock/worker-dock-command-group.test.tsx
  • src/renderer/src/components/native-chat/tools/tasks/dock/worker-dock-groups.ts
  • src/renderer/src/components/native-chat/tools/tasks/dock/worker-dock-labels.ts
  • src/renderer/src/components/native-chat/tools/tasks/dock/worker-dock-summary.ts
  • src/renderer/src/i18n/en-runtime-required.json
  • src/renderer/src/i18n/locales/de.json
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/fr.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/pt.json
  • src/renderer/src/i18n/locales/ru.json
  • src/renderer/src/i18n/locales/tr.json
  • src/renderer/src/i18n/locales/zh-Hant.json
  • src/renderer/src/i18n/locales/zh.json
  • src/shared/agent-status/child-work/agent-status-child-work-evidence-admission.ts
  • src/shared/agent-status/child-work/agent-status-child-work-unverified-stop.test.ts
  • src/shared/agent-status/child-work/agent-status-child-work-view.test.ts
  • src/shared/agent-status/child-work/agent-status-child-work-view.ts
  • tests/tools/worker-dock-rendered/command-group-checks.mjs
  • tests/tools/worker-dock-rendered/run.mjs

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.

- Beside orchestration workers, Stop all always reads "Stop subagents and commands": the stop names
  no target, so it can end work that starts before the tray updates.
- A footer action that leaves while focused hands focus to the pill.
- The rendered keyboard check waits for the exact destination row.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e815ae18-1177-46cd-9eca-dffad22f4005
Commits

Reviewing files that changed from the base of the PR and between 7580c36 and 993e90b.

Files selected for processing: 17

  • src/renderer/src/components/native-chat/tools/tasks/dock/WorkerDockCardFooter.tsx
  • src/renderer/src/components/native-chat/tools/tasks/dock/WorkerDockRoster.tsx
  • src/renderer/src/components/native-chat/tools/tasks/dock/use-worker-dock-footer-focus.ts
  • src/renderer/src/components/native-chat/tools/tasks/dock/worker-dock-command-group.test.tsx
  • src/renderer/src/components/native-chat/tools/tasks/dock/worker-dock-groups.ts
  • src/renderer/src/i18n/locales/de.json
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/fr.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/pt.json
  • src/renderer/src/i18n/locales/ru.json
  • src/renderer/src/i18n/locales/tr.json
  • src/renderer/src/i18n/locales/zh-Hant.json
  • src/renderer/src/i18n/locales/zh.json
  • tests/tools/worker-dock-rendered/command-group-checks.mjs
Files skipped from review as they are similar to previous changes: 11

  • src/renderer/src/i18n/locales/de.json
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/fr.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/pt.json
  • src/renderer/src/i18n/locales/ru.json
  • src/renderer/src/i18n/locales/tr.json
  • src/renderer/src/i18n/locales/zh-Hant.json
  • src/renderer/src/i18n/locales/zh.json

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.

@AmethystLiang
AmethystLiang merged commit b7e1904 into main Nov 27, 2026
57 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant