[BUG] Remote Control session permanently broken after worktree deleted mid-session
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?
A Claude Code remote-control session running in --spawn worktree mode merged its worktree branch back to main and then deleted the worktree directory while the agent was still running inside it. This caused the session to terminate abnormally.
After this, the project could no longer establish a remote-control session. The session shows as "Ready" locally with a valid QR code. No child session process ever spawns.
When I start the browser instance I can see "Dispatch background conversation" flash beneath the other working sessions.
What was tried to recover (all unsuccessful):
- Pruned git worktrees (git worktree prune)
- Deleted stale worktree branch (git branch -D worktree-bridge-cse_...)
- Deleted project .claude/ directory entirely
- Cleared ~/.claude/projects/ entries for the affected project
- Cleared ~/.claude/session-env/ entirely
- Tried different session names
- Tried running the session alone with no other sessions active
Expected behavior:
Restarting remote-control in the same directory should create a fresh session with no lingering state from the previous broken session.
Claude Code version: 2.1.85
What Should Happen?
Restarting remote-control in the same directory should create a fresh session with no lingering state from the previous broken session.
Error Messages/Logs
None displayed - from terminal everything looks fine. No errors on Claude Code view (browser/mobile)
Steps to Reproduce
Steps to reproduce:
- Start claude remote-control --spawn worktree in a git repo
- From the remote session, merge the worktree branch back to main and delete the worktree directory (git worktree remove)
- Session terminates with working directory removed
- Attempt to restart claude remote-control in the same project directory — session never appears in claude.ai/code
Claude Model
None
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.85
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
WSL (Windows Subsystem for Linux)
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗