fix(cli): retry Windows worktree cleanup locks - #9603
Merged
Conversation
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (7 files)
Reviewed by gpt-5.5-2026-04-23 · 365,523 tokens |
imanolmzd-svg
approved these changes
Apr 28, 2026
jliounis
pushed a commit
to jliounis/kilocode
that referenced
this pull request
May 18, 2026
…leanup-retry fix(cli): retry Windows worktree cleanup locks
t7tran
pushed a commit
to t7tran/kilocode
that referenced
this pull request
Aug 14, 2026
…leanup-retry fix(cli): retry Windows worktree cleanup locks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Followup for #9600
Why
This is both a real cleanup bug and a test reliability bug:
Worktree.removecan hit the same slow Windows handle-release race in normal worktree removal, while CI also exposed it during test temp-directory teardown after otherwise-passing tests.We know that from the failure split: some failures came from the production worktree removal path (
git worktree remove/ directory cleanup), and others came only from global test cleanup (EACCES/EBUSYdeletingopencode-test-data-*).Upstream
I checked anomalyco/opencode
dev, recent PRs/issues, and code for an equivalentEBUSY/EACCES/EPERMworktree cleanup fix. I did not find an upstream fix to port.Upstream currently has similar cleanup assumptions, but its recent Windows unit runs are passing; this appears to be a latent Windows race that Kilo hits more often because we run extra worktree/session tests and branch CI combinations.