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
- Launch a long-running command in the background (e.g., a Python script)
- The status bar shows "2 shells"
- The background process crashes (e.g., killed by OOM, unhandled signal, or timeout)
- The status bar still shows "2 shells" even though only 1 is alive
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)
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗