Skip to content

Keep threads with running background subagents on the Working shelf - #1423

Merged
currentbits merged 1 commit into
mainfrom
fix/subagents-keep-working
Oct 4, 2026
Merged

currentbits merged 1 commit into
mainfrom
fix/subagents-keep-working

Conversation

@currentbits

Copy link
Copy Markdown
Owner

Bug: a thread whose turn launched background subagents (Claude's async Agent launches) showed "Waiting on N subagents" on its row but sat under the finished inbox instead of Working.

Root cause: buildFlatSidebar decides the Working shelf with isQuietlyWorking (src/sidebarGroups.ts), which only checked status === "working". The #1421 family rule covers forked child threads, not thread.subagents. A background agent outlives the turn, so the thread reads done while work continues. The row pill, Kanban, status filter and Agents tab already count running subagents via buildWaitStates / isDelegating; only the shelf split didn't.

Fix:

  • isQuietlyWorking also counts a done/idle thread with a running subagent. This is the same rule as isDelegating, and awaitingInput, stalls and failed still send the row to the inbox.
  • The runner's two subagent-settle paths (ingestTaskNotifications between turns, and finishRunningSubagents on CLI exit) now push threads:changed. Without that, the list never refreshed and the row would stick on Working after the agents finished.

Verified on live data: the one thread in the store with running subagents and a non-working status was filed in the inbox before this change.

Tests:

  • test/sidebarGroups.test.ts: done/idle with a running subagent → Working; settled, asking or failed → inbox.
  • electron/test/claude.test.js: a new fake scenario where the notification lands after the turn's result asserts a threads:changed push with the settled row. It failed before the runner change.
  • Typecheck clean. Renderer 2675/2675. claude.test.js 39/39, cursor.test.js 30/30.

Note: if a task-notification is ever lost, the row stays on Working until the CLI is reaped, which settles any running rows. Today that case only showed a wrong pill.

🤖 Generated with Claude Code

A Claude turn that launches a background Agent ends (status done) while
the agent keeps running, and the flat sidebar's busy check only looked
at status === "working" and forked child threads. The row pill already
read "Waiting on N subagents" (isDelegating), but the thread sat in the
inbox. isQuietlyWorking now also counts a done/idle thread with a
running subagent, matching isDelegating; questions and stalls still win.

Subagent rows settle between turns (task-notification) or on CLI exit,
and both paths only pushed the detail, so the list never refreshed and
the row would have stuck on Working. Both now push threads:changed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@currentbits
currentbits merged commit b6db275 into main Oct 4, 2026
6 checks passed
@currentbits
currentbits deleted the fix/subagents-keep-working branch October 4, 2026 13:43
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