Background tasks (run_in_background Bash + Agent) stay "Running" in the panel forever after completing

Open 💬 2 comments Opened Jun 10, 2026 by zulven

Bug

Background tasks (run_in_background: true Bash, and Agent/subagent tasks) never transition out of the Running section of the Background-tasks panel, even after they complete successfully — they accumulate indefinitely and persist across app restarts.

Repro

  1. Have the model run a Bash command with run_in_background: true that exits quickly (e.g. an until-loop poll that completes).
  2. The task completes: exit code 0, the <task-notification> is delivered to the conversation, and TaskStop/TaskOutput on its ID return "No task found" (the agent-side registry has GC'd it).
  3. The Background-tasks panel still shows it under Running — forever. Foreground Bash invocations from the same session correctly appear under Finished.

Observed scale

One project accumulated 88 "Running" entries (durations up to 27,929 minutes ≈ 19 days). After a manual flush, 9 re-accumulated within a day — including a task that verifiably completed with a delivered notification 5+ hours earlier (panel showed Bash 332m, still Running). Agent-type tasks from ~3 weeks ago show the same stuck state with viewable transcripts.

Expected

A background task whose process has exited (success or failure) should move to Finished like foreground tasks do, or at minimum be reaped when the harness GC's it from the tool-facing registry (the two views currently disagree: TaskStop says "No task found" while the UI says "Running").

Environment

  • Linux dev box (Ubuntu, kernel 6.17), Claude Code CLI with Remote Control enabled (panel observed via Remote Control UI)
  • Version: 2.1.170 (Claude Code)

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗