claude-code - 💡(How to fix) Fix [BUG] Tasks sidebar shows zombie "Running" entries after background Bash tasks complete; Stop button is 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

Error Messages/Logs

Fix Action

Fix / Workaround

  • Workaround: /clear or session restart drops the zombie entries.
  • Conjecture: the harness emits the completion event to the chat (notification arrives) but doesn't emit it to the sidebar UI's task-state store, so the sidebar's render keeps showing Running. The fact that TaskStop reports "No task found" suggests the harness-side task record is correctly cleaned; only the UI subscription is missing an update.

Code Example

echo "DONE" > /tmp/sentinel.txt
   # then in a separate assistant turn with run_in_background: true:
   until grep -q "DONE" /tmp/sentinel.txt; do sleep 5; done

---

ps aux | grep "until grep" | grep -v grep

---

TaskStop tool result for the zombie's original task_id:
  "No task found with ID: bb39ysgjg"
  "No task found with ID: b4ulwd5aw"
RAW_BUFFERClick to expand / collapse

What's Wrong?

Background Bash tasks launched via run_in_background: true (e.g., until grep -q ...; do sleep 5; done polling loops) leave zombie entries in the Tasks sidebar after they've actually finished. The sidebar shows them as Running with a Stop button, but:

  • The underlying shell processes have already exited (ps aux | grep returns nothing matching)
  • The harness itself has dropped the tasks — calling the TaskStop tool with the original task ID returns No task found with ID: <id>
  • Clicking the Stop button in the sidebar does nothing — the entry stays visible
  • The completion notification DID fire correctly in the chat at the time the process exited; only the sidebar UI is stale

After several deploys in one session, four zombie entries accumulated in the panel. None of them can be cleared.

What Should Happen?

When a background Bash task exits, the corresponding sidebar entry should either move to a "Completed" section or be removed. The Stop button on a sidebar entry should reliably terminate the underlying process OR (if the process is already gone) clear the sidebar entry as a fallback.

Steps to Reproduce

  1. Launch a short-lived background Bash task in the assistant tool — e.g., poll a log file for a sentinel line:
    echo "DONE" > /tmp/sentinel.txt
    # then in a separate assistant turn with run_in_background: true:
    until grep -q "DONE" /tmp/sentinel.txt; do sleep 5; done
  2. Wait for the completion notification in chat (arrives within seconds since the sentinel already matches).
  3. Open the Tasks sidebar — the task still appears as Running.
  4. Click Stop — nothing changes.
  5. Confirm via shell that no matching process exists:
    ps aux | grep "until grep" | grep -v grep
  6. Repeat steps 1–5 a few times during the same session — the panel accumulates zombie entries.

Error Messages/Logs

TaskStop tool result for the zombie's original task_id:
  "No task found with ID: bb39ysgjg"
  "No task found with ID: b4ulwd5aw"

(So the harness has cleaned up its task records; only the sidebar UI is stale.)

Claude Model

Opus 4.7 (1M context) — model id claude-opus-4-7[1m]

Is this a regression?

I don't know

Claude Code Version

2.1.71 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Other — Claude Code desktop app (Cowork) on macOS Darwin 25.4.0, zsh shell.

Additional Information

  • Workaround: /clear or session restart drops the zombie entries.
  • Conjecture: the harness emits the completion event to the chat (notification arrives) but doesn't emit it to the sidebar UI's task-state store, so the sidebar's render keeps showing Running. The fact that TaskStop reports "No task found" suggests the harness-side task record is correctly cleaned; only the UI subscription is missing an update.

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 [BUG] Tasks sidebar shows zombie "Running" entries after background Bash tasks complete; Stop button is no-op