Repository navigation
fix(worktree): verify exited PTYs before blocking deletion - #10106
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughWorktree teardown now collects unsuccessful PTY stop attempts and rechecks provider inventory before declaring physical teardown failure. The verification uses the remaining deadline and treats query failures or unavailable sessions as unsuccessful verification. A Windows-specific test covers provider shutdown rejection followed by an empty PTY inventory and verifies zero teardown counts. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
#10115) - orca-runtime: 'stop cannot be proven' now requires the fresh PTY inventory to still show the pty live (empty inventory proves exit post-#10106). - git-common-watch: swap worktrees dir->file synchronously so no poll tick observes the transient ENOENT window and fabricates a delete. (cherry picked from commit e11736d7e170982eeebe09256eb549446a4f4f7b) Co-authored-by: Orca <help@stably.ai>
stablyai#10115) - orca-runtime: 'stop cannot be proven' now requires the fresh PTY inventory to still show the pty live (empty inventory proves exit post-stablyai#10106). - git-common-watch: swap worktrees dir->file synchronously so no poll tick observes the transient ENOENT window and fabricates a delete. (cherry picked from commit e11736d7e170982eeebe09256eb549446a4f4f7b) Co-authored-by: Orca <help@stably.ai>
Description
On Windows, deleting a worktree could fail forever with:
The failure occurred when the daemon had already killed the ConPTY, but one stop path lost/timed out on the acknowledgement and the duplicate fallback received
Session not found. Teardown permanently latched those negative stop results even though the authoritative process inventory was already empty.This change uses the existing teardown RPC margin for a fresh provider inventory when any stop reports failure:
The behavior applies to local daemon PTYs and connection-scoped SSH providers without changing path matching, persistence, or the worktree removal API.
ELI5
Orca asks several systems to stop a terminal before deleting its folder. Sometimes Windows stops the terminal successfully, but one system misses the confirmation and says “I couldn't stop it.” Orca used to trust that stale answer forever.
Now Orca checks the live terminal roster one final time. If the terminal is definitely gone, deletion proceeds. If it is still there—or Orca cannot check safely—deletion remains blocked.
Evidence of fix
Reproduction first
awinWindows environment to create disposable worktrees and exercise deletion with a live PowerShell PTY and a long-running child process. Those baseline cases succeeded, narrowing the bug to stale/failed acknowledgement state rather than Windows paths or ordinary live processes.Automated verification
Also passed:
pnpm run typecheck:nodeoxlintoxfmt --checkpnpm run check:max-lines-ratchetgit diff --checkAdversarial review loop
User-facing regression list
Known user-facing regressions: none.
Explicitly checked: