Skip to content

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

Closed as not planned

Description

@LeSoviet

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.

Activity

  1. added theissue type on Jul 16, 2026
  2. AmethystLiang commented on Jul 19, 2026

    @AmethystLiang
    Contributor

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingos:macosIssues affecting macOS

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions