Orphaned Claude session survives 11h after worktree deletion, ignores SIGTERM

Resolved 💬 3 comments Opened Apr 11, 2026 by MechanicalHuman Closed May 23, 2026

Bug Description

A Claude Code session started inside a git worktree continued running for 11+ hours after the worktree directory was deleted. The process remained alive with no valid working directory and did not exit on its own. It also ignored SIGTERM and required SIGKILL to terminate.

Environment

  • Claude Code version: 2.1.100
  • OS: macOS Darwin 25.3.0 (Apple Silicon)
  • Shell: zsh

Steps to Reproduce

  1. Start a Claude Code session inside a git worktree (e.g. /path/to/worktrees/repo/branch-name)
  2. From another terminal or session, delete/remove the worktree (git worktree remove or similar)
  3. The Claude process continues running indefinitely

Observed Behavior

  • lsof -p <pid> shows cwd pointing to the now-deleted worktree directory
  • kill <pid> (SIGTERM) has no effect — process remains alive
  • kill -9 <pid> (SIGKILL) is required to terminate it
  • Process ran for over 11 hours in this state

Expected Behavior

Claude Code should detect that its working directory no longer exists and exit gracefully, or at minimum respond to SIGTERM.

Diagnostic Output

$ ps -eo pid,etime,command | grep claude
57363    11:12:23 claude

$ lsof -p 57363 | grep cwd
2.1.100 57363 user  cwd  DIR  1,14  64  7676011 /Volumes/.../worktrees/daze-protocol/replica-regions

The directory /Volumes/.../worktrees/daze-protocol/replica-regions no longer existed at the time of discovery.

View original on GitHub ↗

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