[BUG] Bash tool timeout kills Claude Code process (SIGTERM propagation), not just the child command
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?
When a Bash tool call exceeds its timeout (default 120000ms), the SIGTERM that kills the child process also kills the Claude Code process itself. The tmux pane reports "Pane is dead (status 143)" — meaning Claude Code (not just the subprocess) received SIGTERM.
This makes any long-running command (e.g., make check, go test ./...) fatal to the agent session. In automated/headless setups where a session manager restarts the agent, this creates a crash-loop: restart → run same command → timeout → SIGTERM → crash → restart.
What Should Happen?
The Bash tool's timeout should:
- Kill only the child process (and its process group)
- Return a timeout error to the model (e.g., "command timed out after 120000ms")
- Allow the model to continue the conversation and decide what to do
A timeout is a recoverable condition. The Bash tool already has a timeout parameter, implying timeouts are expected and should be handled gracefully.
Error Messages/Logs
Observed directly in a tmux-managed agent session:
# Claude Code running make check (which takes ~3 minutes)
# UI shows "Jitterbugging" spinner
# At 1m 56s mark (approaching 2-minute default timeout):
Exit code 144
Pane is dead (status 143)
Status 143 = 128 + 15 = killed by SIGTERM. The pane dying means the Claude Code process itself was terminated, not just the child command.
In a managed environment with auto-restart, this caused 60+ crash-loop iterations on a single agent session (the session manager restarted the agent, which re-ran the same command, which timed out again).
Steps to Reproduce
- Run Claude Code in a tmux session (headless/non-interactive):
````
claude --dangerously-skip-permissions
- Have the agent run a Bash command that takes longer than the default 2-minute timeout without setting an explicit timeout:
````
Bash(command="sleep 180") # or any command >2 minutes: make check, go test, etc.
- Wait for the 2-minute timeout to fire.
- Observe: the entire Claude Code process dies (tmux pane shows "Pane is dead (status 143)"), rather than the Bash tool returning a timeout error to the model.
Claude Model
- Opus
Is this a regression?
- I don't know
Claude Code Version
2.1.97 (Claude Code)
Platform
- Anthropic API
Operating System
- Ubuntu/Debian Linux
Terminal/Shell
- Non-interactive/CI environment
Additional Information
The signal propagation issue may be related to process group handling. If Claude Code and the child shell share a process group, sending SIGTERM to the group to kill the child would also kill the parent. The fix would be to spawn child processes in a new process group (setsid or equivalent) and signal only that group.
Possibly related: #40207 (Claude Code sends SIGTERM to healthy MCP servers) — another case of SIGTERM reaching processes that shouldn't receive it.
Environment: Ubuntu 24.04, tmux-managed sessions, Claude Code running as an autonomous agent with --dangerously-skip-permissions. Reproducible across multiple agent sessions over multiple days.
This issue has 7 comments on GitHub. Read the full discussion on GitHub ↗