claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[BUG] Stale background process reminders continue after process is killed

Open mtompkins opened this issue 1 month ago • 2 comments

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

System reminders about background bash processes (started with run_in_background: true) continue appearing even after the process has been killed, causing confusion about what's actually running

Reminders continue with "status: running" even though the process is dead

What Should Happen?

Reminders should stop after a process is terminated

Error Messages/Logs


Steps to Reproduce

a. Start a background process with the Bash tool
b. Kill the process (either through KillShell or it terminates)
c. System reminders continue appearing indefinitely about the dead process

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

No response

Claude Code Version

2.0.31

Platform

Anthropic API

Operating System

Other Linux

Terminal/Shell

Other

Additional Information

No response

mtompkins avatar Nov 02 '25 07:11 mtompkins

I think this is a duplicate of:

  • #7479

This problem was killing me.

joeflack4 avatar Nov 15 '25 18:11 joeflack4

Confirming on Windows + Correlation with Context Compression

Same issue on Windows (MINGW64_NT-10.0-26100) with Opus 4.5.

Current Session Example

7 stale shell reminders appearing continuously:

Background Bash 3058e2 (command: python run_server.py) (status: running) Has new output available
Background Bash 37e198 (command: python run_server.py) (status: running) Has new output available
... (5 more)
  • KillShell on all 7 IDs: 6 report "not running, so cannot be killed (status: killed)", 1 succeeded
  • tasklist | grep python shows no Python processes
  • powershell Get-CimInstance Win32_Process | Where ParentProcessId -eq <claude_pid> shows only 1 actual bash child

Context Compression Trigger

In my case, these stale reminders appear after context compression/summarization. The background shells were likely spawned earlier in the conversation (before compression), but their tracking state persisted while the actual processes terminated.

This seems to be the same root cause as issue #12835 (Edit tool false "file modified" errors) - internal state not being properly cleaned up during context compression.

Impact

The constant system reminders in every response add noise and make it harder to parse actual output. Would be helpful if dead shells were automatically cleaned up, or at least stopped generating reminders.

NullCoward avatar Dec 07 '25 21:12 NullCoward