Tasks sidebar: completed background bash tasks stay as "Running"; dismiss (X) button is unresponsive
Summary
The Tasks sidebar keeps showing completed background Bash tasks (started via run_in_background: true) in the Running state long after their processes have exited. The dismiss (✕) button on those stale entries does not respond, so they accumulate with no way to clear them from the UI.
Environment
- Claude Code version: 2.1.77
- OS: macOS (Darwin 25.2.0)
- Shell: zsh
What I observed
A session's Tasks sidebar shows ~15 entries marked as Running:
Build admin app(×3)Build owner app(×2)Watch CI checks/Watch CI checks to completion/Watch CI checks until complete/Watch CI checks on PR 148— 5 totalSquash merge PR from main worktreeSquash merge PR 147 from main worktreeSquash merge PR 148 from main worktreeInstall dependencies to wire api-client ...Regenerate pnpm lockfile after removing ...
Cross-checking against actual live processes with ps aux | grep -E 'gh pr checks|pnpm|turbo':
mitiay 69148 ... pnpm --filter owner dev --port 3000
mitiay 69147 ... pnpm --filter admin dev --port 3001
mitiay 69138 ... pnpm --filter owner dev --port 3000
mitiay 69137 ... pnpm --filter admin dev --port 3001
Only 4 processes are alive — the pnpm --filter <app> dev instances behind the Build admin app / Build owner app entries. None of the Watch CI checks, Squash merge, Install dependencies, or Regenerate pnpm lockfile processes are still running.
So ~11 of the 15 "Running" entries are stale UI state.
Additional bug: ✕ button doesn't dismiss stale tasks
Clicking the ✕ icon on any of the stale "Running" entries has no effect — the entry stays. There is no way to clear the list from the UI, and it grows across sessions.
Expected behavior
- When a backgrounded Bash task exits, its Tasks sidebar entry should transition to its final state (completed / failed / killed) instead of staying Running indefinitely.
- The ✕ / dismiss button should always remove an entry from the sidebar, regardless of its reported status.
Impact
- The Running badge in the sidebar is no longer trustworthy — you can't tell at a glance which tasks are actually live.
- Because the dismiss button is unresponsive, the list just accumulates — currently ~15 stale entries across several sessions.
Screenshot
Will attach sidebar screenshot via the GitHub web UI after creation.
Found 3 possible duplicate issues:
- https://github.com/anthropics/claude-code/issues/41023
- https://github.com/anthropics/claude-code/issues/39968
- https://github.com/anthropics/claude-code/issues/44357
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
Same behavior reproduced on Windows 11 (Claude Code on Windows), and it also affects foreground Bash tool calls — not only background ones started with run_in_background: true.
Environment
- OS: Windows 11 Pro 10.0.26200
- Shell: bash (Git Bash)
- Claude Code: 2.1.109
What I observed
In a single session I ran ~7 synchronous Bash commands (all foreground, no run_in_background), e.g.:
Check gh auth and repo accessList existing labels and milestonesCreate labels and milestoneCreate issues 1-2/3-4/5-6/7-8
All of these completed normally — the model received their output and continued the conversation successfully (GitHub issues were created, URLs returned). Despite that, every single entry remains in the Tasks / "Wird ausgeführt" (Running) section of the sidebar indefinitely.
Only an Agent invocation in the same session correctly transitioned to "Abgeschlossen" (Completed).
The dismiss (✕) button on the stuck foreground entries is unresponsive, same as reported in the original issue.
So in addition to the original bug
The sidebar not only fails to transition background Bash tasks when they exit — it also never transitions foreground Bash calls, even though those are strictly synchronous and provably finished (their output was consumed by the model mid-turn).
Expected
Foreground Bash tool calls should either:
- not appear in the Tasks sidebar at all (they're synchronous and have no lifecycle the user needs to track), or
- transition to a terminal state (completed / failed) the moment the tool call returns.
Same issue on Windows 11 Pro (10.0.26200). Completed Bash tasks remain as "Running" and the dismiss (X) button is unresponsive.
+1, still reproducing on latest version:
- Claude Code: 2.1.116 (desktop)
- OS: macOS 26.4 (build 25E5223i)
- Tasks panel currently shows 13 stuck "Running" entries accumulated across this session and prior sessions
- Mix of Bash (
run_in_background: true) tasks and Agent (sub-agent) task IDs - Calling
TaskStopwith known IDs returnsError: No task found with ID: <id>— confirms backend state is clean, UI just isn't syncing - Clicking the × button on each entry is unresponsive (no visual feedback, entry remains)
- Only workaround seems to be restarting the app
Filed ~6 days ago, still present in 2.1.116. Bumping visibility. See also #51490 (same root cause from the TaskStop-side angle).
Similar shape to #51490. While the sidebar is unresponsive, claude-code-shepherd reads the real process state from ps via tracked session files and shows it via /shepherd:processes. Completed tasks show up as dead entries that are filtered out; live ones show RAM, uptime, ports. Gives you a clean "what's actually still running from this session" view without waiting for the sidebar to clear. Doesn't fix the sidebar UI bug, but is a working readout while it's broken.
+1, reproducing on Claude Code 2.1.121 (Windows 11 Pro 10.0.22631) — newer than the last report in this thread.
New trigger surface in my case: subagent-spawned bash, not a direct tool call. An Explore subagent shelled out to find while looking for MCP config files:
find ~/ -type f \( -name ".claude.json" -o -name ".mcp.json" -o -name "claude_desktop_config.json" \) 2>/dev/null
The find ground through the entire home directory (slow on Windows due to OneDrive / AppData / node_modules). The OS process eventually disappeared, but the Tasks panel kept the entry as Running indefinitely — clicking the ✕ did nothing, same as everyone else here. Suggests the lifecycle-tracking gap isn't specific to run_in_background: true; subagent-orchestrated bash hits the same dead-end UI state.
Windows verification command (parity with the Mac ps aux checks above):
Get-CimInstance Win32_Process -Filter "Name='find.exe'" | Format-Table ProcessId, CommandLine
Empty result + UI still showing "Running" = the bug.
Preventive mitigation that pairs with the readout workaround above: a user-scope permissions.deny rule for Bash(find:*) in ~/.claude/settings.json blocks the harness from spawning slow home-dir traversals in the first place. Doesn't fix the UI bug, but prevents the most painful trigger (and stops accumulating stuck entries from this specific cause). Same pattern works for any other long-traversal commands you can name up front.
Related — same root-cause family from different angles:
- #51490 —
TaskStopcannot reach these entries (UI-side dead path) - #55659 — completed shells stay visible as active
- #53961 —
find /from a subagent taken to its catastrophic extreme (full macOS reboot loop) - #1935 / #33947 / #43944 / #54130 — orphan MCP / subprocess accumulation, same lifecycle-tracking gap
Looks like the underlying bug is "tool-call lifecycle events don't always reach the UI state machine, and the UI has no fallback reconciliation path." The shepherd plugin does that reconciliation externally; ideally Claude Desktop would do it natively.
+1 — hit this today on Claude Code 2.1.105 / macOS 26.0.1 (Desktop app).
Two repro variants worth adding to this issue:
-
Worktree deletion under an active poller. Agent spawns a poller like
until grep -q DONE /private/tmp/.../tasks/<id>.output; do sleep 5; doneagainst an output file inside a git worktree. The worktree is later removed (deliberately, or because the agent rangit worktree remove). The poller's wait condition becomes structurally unreachable — but the row stays "Running" forever. Process is also still alive in this variant;ps aux | grep "until grep"shows it spinning indefinitely. -
Agent self-cleanup via
pkill. When the agent itself notices the panel is full of dead pollers and runspkill -f "until grep"to clean up, the OS-level processes die immediately (psconfirms zero matches) but the Tasks panel still shows them as "Running" with the live blue dot. Stop button does eventually clear them, but only with one click per row — exactly the friction the panel is supposed to abstract.
In one session I accumulated 7 stuck rows from a mix of these two paths. None represented live processes by the time I noticed.
Suggested fix (same as discussed upthread): a supervisor reaper that runs kill(pid, 0) against every "Running" task's PID every few seconds and transitions dead ones to a terminal state. For the variant-1 case (process still alive but wait condition unreachable), there's no automatic detection — but a per-task max-age timeout or "stop all stuck pollers" bulk action would help a lot.
Happy to provide more session logs if useful.