Zombie background shell reminders accumulate during long sessions
Resolved 💬 2 comments Opened Dec 9, 2025 by yoichiojima-2 Closed Dec 10, 2025
Description
During long Claude Code sessions that use background processes (run_in_background: true), "zombie" shell reminders accumulate and persist even after the actual processes have exited. These stale reminders clutter every subsequent message with notifications like:
<system-reminder>
Background Bash 3cd15a (command: ...) (status: running) Has new output available.
</system-reminder>
Steps to Reproduce
- Start a long session that involves debugging/iterating on server code
- Use
run_in_background: truemultiple times (e.g., starting servers that crash, restarting after fixes) - Continue the session until context summarization occurs
- Observe that all background shell reminders persist, even for processes that:
- Crashed immediately with errors
- Were explicitly killed
- Completed successfully
Expected Behavior
- Shell reminders should only appear for actually running processes
- When a background process exits (success, failure, or killed), its reminder should be removed
- After context summarization, only truly running processes should have reminders
Actual Behavior
- All shell reminders persist indefinitely after context summarization
- Calling
KillShellon zombie shells returns "Shell X is not running" but the reminder persists - Each message includes 15+ stale reminders that cannot be cleared
Environment
- Claude Code CLI
- Long session with context summarization
- Multiple background process start/stop cycles
Impact
- Message clutter reduces readability
- Confusion about which processes are actually running
- No way to clear stale reminders
Possible Causes
- Context summarization preserves shell metadata but doesn't sync with actual process state
- No cleanup mechanism when background processes exit
- Shell tracking state not updated when processes fail immediately after starting
🤖 Generated with Claude Code
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗