Background shell count not decremented when process dies

Resolved 💬 3 comments Opened Mar 25, 2026 by vincentdolez Closed Mar 29, 2026

Description

When a background command (launched via Bash tool with run_in_background) crashes or is killed, the shell counter in the status bar still counts it as an active shell. The slot is never released until the session ends.

Steps to reproduce

  1. Launch a long-running command in the background (e.g., a Python script)
  2. The status bar shows "2 shells"
  3. The background process crashes (e.g., killed by OOM, unhandled signal, or timeout)
  4. The status bar still shows "2 shells" even though only 1 is alive
  5. ps aux | grep <command> confirms the process is dead

Expected behavior

When a background process exits (whether normally or abnormally), the shell counter should decrement and the slot should be freed.

Actual behavior

Dead background processes remain counted as active shells for the entire session duration.

Environment

  • Claude Code CLI
  • macOS (Darwin 25.3.0)
  • Model: Opus 4.6 (1M context)

View original on GitHub ↗

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