Background task chips persist as 'Running' after subagent exits; Stop button no-ops

Status Fixed / completed
Reported on v2.1.141
Maintainer reply None cached
Activity 3 comments · opened May 18, 2026 · closed May 18, 2026

Summary

Background Bash tasks (run_in_background: true) started inside a delegated subagent persist in the parent session's "Background tasks → Running" panel after the subagent exits. The underlying processes are gone (ps confirms), but the chips remain, and the Stop button silently does nothing — presumably because there's no process to signal.

The only way to clear them is to restart Claude Code.

Environment

  • Claude Code version: 2.1.141
  • Platform: macOS (Darwin 25.3.0)
  • Shell: zsh
  • Model: claude-opus-4-7 (1M context)

Reproduction

  1. From the parent session, delegate work to a subagent via the Agent tool (e.g. subagent_type: reviewer).
  2. Inside that subagent, run one or more Bash calls with run_in_background: true (e.g. polling a long-running command while it waits to complete).
  3. Let the subagent complete and return its result to the parent.
  4. Open the "Background tasks" panel in the parent session.

Expected: background tasks scoped to the subagent are reaped when the subagent exits, or at minimum the chips reflect a terminal state (completed/cancelled).

Actual: the chips remain pinned to "Running" indefinitely. ps -ef shows no matching processes — they're already gone. Clicking "Stop" on the chip does nothing visible (no state change, no log entry, no error). Restart clears them.

Why this matters

  • Misleading UX: looks like work is still happening when nothing is.
  • The parent agent has no way to introspect or clean these up either — TaskStop requires a task_id that the parent never received (the ID was returned inside the subagent's context, not the parent's). There's no "list background tasks" tool surfaced to the parent.
  • Users can't tell genuinely stuck tasks from stale chips.

Suggested fixes (any one would help)

  1. Reap background tasks at subagent exit — same boundary that bounds the subagent's tool context.
  2. Promote chip state on process death — if the PID is gone, mark the chip Completed/Failed instead of Running.
  3. Make Stop force-clear the chip when no process matches, even if it can't signal anything.
  4. Surface a BackgroundTaskList tool to the parent agent so it can enumerate and clean up tasks left behind by subagents.

View original on GitHub ↗

3 Comments

gmcdowell · 5 months ago

Closing — filed in error; will refile a clean version.

github-actions[bot] · 5 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/55893
  2. https://github.com/anthropics/claude-code/issues/48312
  3. https://github.com/anthropics/claude-code/issues/58457

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

github-actions[bot] · 2 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.