[BUG] VS Code extension orphans prior `claude` process on relaunch; orphan replays instructions and auto-commits unattended

Open 💬 0 comments Opened Jul 4, 2026 by RaphazZze

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?

Relaunching/resuming a session in the VS Code extension leaves the prior claude process running instead of terminating it. Because sessions launch with --replay-user-messages and --permission-mode auto, an orphaned process replayed an earlier "do this autonomously" instruction and made ~4 git commits over ~18 minutes with no attached user and no user turns.

What Should Happen?

  • On relaunch/resume, the prior session's process should be terminated, not left running.
  • A detached process (no attached UI/user) should not keep executing turns or writing to the repo.
  • --replay-user-messages should not cause an orphan to autonomously re-execute prior instructions.

Error Messages/Logs

Steps to Reproduce

  1. In the VS Code extension, give a session an instruction to perform a multi-step task autonomously.
  2. Trigger relaunch/resume one or more times (e.g. "Continue from where you left off" / window reload).
  3. ps -Ao pid,lstart,command | grep 'native-binary/claude' | grep -v grep → prior processes are still alive.
  4. Observe an orphaned process continuing the task (edits/commits) with no user input.

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.199-darwin-arm64 (VS Code extension)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

VS Code integrated terminal

Additional Information

  • One VS Code window spawned 6 native-binary/claude processes over ~40 min (staggered starts, one parent extension host), though the user had only one tab open.
  • Launch flags observed via ps: --resume --replay-user-messages --permission-mode auto --output-format stream-json --input-format stream-json (note: --dangerously-skip-permissions was absent).
  • git reflog/git log showed 4 commits landing during a window with no interactive git commit turns; commit messages matched an earlier task instruction.
  • Mitigation: identify the current session's PID (walk the parent chain from the terminal shell up), kill the other claude PIDs. Already-made commits are preserved on the branch.
  • May relate to existing orphaned-process-on-resume reports — please dedupe.

View original on GitHub ↗