orca icon indicating copy to clipboard operation
orca copied to clipboard

[Bug]: "Failed to physically stop every PTY" — worktree deletion fails, requires manually killing orphaned claude.exe/node.exe/cmd.exe processes

Open LeSoviet opened this issue 4 months ago • 1 comments

Operating system

Windows 10

Orca version

v1.4.143.0

Details

Environment

  • OS: Windows 10
  • Agent CLIs used in worktrees: Claude Code, Codex, Kilo Code

Bug Deleting a worktree fails consistently with:

Error invoking remote method 'worktrees:remove': Error: Failed to physically stop every PTY for worktree: ::

or, on the "Force Delete" path:

Error invoking remote method 'worktrees:remove': Error: Timed out waiting for physical PTY teardown: ::

This has now happened on two separate worktrees ("snaggletooth" and "anhinga"), so it appears to be reproducible rather than a one-off.

Root cause (as far as I can tell) Using Sysinternals handle.exe on the worktree folder shows dozens of orphaned processes still holding open file handles into the worktree directory — claude.exe, node.exe, and cmd.exe, well beyond what should be running for a single session (20+ handles across repeated cmd.exe/node.exe instances). It looks like Orca is not properly terminating child processes (PTYs spawned for agent CLIs) when a worktree/session is closed, so they linger and block folder deletion.

Steps to reproduce

  1. Run an agent (Claude Code / Codex / Kilo Code) inside an Orca worktree.
  2. Close the session / try to delete the worktree from the UI.
  3. Deletion fails with the PTY teardown error above.
  4. Inspecting the worktree folder with handle.exe shows many orphaned claude.exe/node.exe/cmd.exe processes still holding file handles.

Current workaround Manually force-kill the relevant processes, then delete the folder:

Stop-Process -Name claude -Force -ErrorAction SilentlyContinue Stop-Process -Name node -Force -ErrorAction SilentlyContinue Stop-Process -Name cmd -Force -ErrorAction SilentlyContinue Remove-Item -Recurse -Force ""

A full OS restart also works but obviously isn't a practical daily workflow.

Expected behavior When a worktree is closed or deleted, Orca should reliably terminate all child processes/PTYs it spawned (including nested node/cmd processes from CLI agents) before attempting folder removal, without requiring manual process killing or a system restart.

LeSoviet avatar Jul 16 '26 17:07 LeSoviet

Duplicate of #9045 (same author / same body).

This issue was closed without discussion; investigation and ongoing work live on #9045.

AmethystLiang avatar Jul 19 '26 19:07 AmethystLiang