claude-code - 💡(How to fix) Fix Sub-agent bash tasks stuck 'running' in Tasks panel after agent completes; Stop button no-op

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

When a sub-agent completes (regardless of success/error/cancelled), every bash task started during its lifetime should disappear from the parent chat's "running" indicator. The Stop button on a stuck task should at minimum let the user clear the slot manually.

Fix Action

Workaround

None known besides ignoring it until next UI refresh / session change. No functional impact.

RAW_BUFFERClick to expand / collapse

Symptom

When the main chat spawns a sub-agent via the Agent tool with run_in_background: true, and that sub-agent internally invokes Bash commands, those bash commands appear in the UI Tasks panel. After the sub-agent has fully completed (completion notification has reached the parent chat, commits pushed, agent summary received), the bash tasks remain listed as "Wird ausgeführt" / "Running" in the panel. Clicking the Stop button next to one of those tasks has no visible effect — the task stays in the list.

Repro

  1. In the main chat: spawn ≥2 sub-agents in parallel with run_in_background: true. Each sub-agent should internally run several Bash commands (e.g. Run pytest …, Run baseline tests).
  2. Wait until both sub-agents finish (completion notifications arrive in the parent chat).
  3. Open the UI Tasks panel → the sub-agents' internal bash tasks are still shown as "Wird ausgeführt".
  4. Click Stop on one of them → no effect; the task stays in the list.

Concrete example observed today (2026-05-12)

  • Sub-agent A (id a03326852bd70edf8): "Fix node_join.py alias_fields + LEFT JOIN bugs" → committed 7bbcc9a2, sent its result summary back to parent.
  • Sub-agent B (id a4aef66c9086d38ef): "Fix compound_filter neq with empty string" → committed 3785c5c6, sent its result summary.
  • 1+ hour after both completion notifications arrived, the UI shows 12 bash tasks still as "running":
    • Run baseline tests
    • Run pytest with -x to fail fast
    • Test if Bug 1 is fixed
    • Re-test Bug 1 fix execution
    • Run pytest skipping pre-existing failure
    • Find close_jn references in history
    • Wait for pytest to finish, print summary
    • Run full test suite excluding live/drive cache tests
    • Run focused test suite without slow tests
    • Run full test suite
    • Wait for tests to complete
    • Run tests with unbuffered output

On the OS side there are no corresponding processes alive (ps aux | grep pytest empty). It's purely a UI state-sync issue.

Expected

When a sub-agent completes (regardless of success/error/cancelled), every bash task started during its lifetime should disappear from the parent chat's "running" indicator. The Stop button on a stuck task should at minimum let the user clear the slot manually.

Suspected cause

The Tasks panel probably counts bash slots transitively (parent-chat bashes + all sub-agent bashes). When the agent's lifecycle ends, the cleanup event for the children isn't propagated into the UI pipeline.

Side effect

The status line shows e.g. "12 Shells laufen" / "12 shells running" even when the OS has zero such processes. Cosmetic but confusing.

Platform

  • Claude Code CLI (macOS, Darwin 25.3.0)
  • Model: Opus 4.7 (claude-opus-4-7)
  • Project: a software-engineering session with two parallel sub-agents

Workaround

None known besides ignoring it until next UI refresh / session change. No functional impact.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix Sub-agent bash tasks stuck 'running' in Tasks panel after agent completes; Stop button no-op