Sub-agent bash tasks stuck 'running' in Tasks panel after agent completes; Stop button no-op
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
- In the main chat: spawn ≥2 sub-agents in parallel with
run_in_background: true. Each sub-agent should internally run severalBashcommands (e.g.Run pytest …,Run baseline tests). - Wait until both sub-agents finish (completion notifications arrive in the parent chat).
- Open the UI Tasks panel → the sub-agents' internal bash tasks are still shown as "Wird ausgeführt".
- 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" → committed7bbcc9a2, sent its result summary back to parent. - Sub-agent B (id
a4aef66c9086d38ef): "Fix compound_filter neq with empty string" → committed3785c5c6, 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.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗