Conversation
gc_orphans: retry remove_dir_all with exponential backoff, fall back to cmd /c rmdir, detect locking process via handle64.exe. cleanup-branches.sh: retry git worktree remove on Permission denied with backoff; distinguish dirty vs locked; warn and fall through on lock so branch cleanup is not blocked. Item #302: git worktree remove --force .worktrees/ fails with Permission denied on Windows when rust-analyzer holds file handles. Agentflare-Agent: 1 Agentflare-Branch: feat/worktree-audit-294
|
Warning Review limit reached
Next review available in: 51 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
Agentflare-Agent: claude-code_2-1-217_agent Agentflare-Branch: task/308 Agentflare-Item: 308
Agentflare-Agent: claude-code_2-1-217_agent Agentflare-Branch: task/308 Agentflare-Item: 308
Summary
Supersedes #306, which is stuck in a
CONFLICTINGstate — its branch (feat/worktree-audit-294) still carries the pre-squash commit history of the already-merged #294/#304, diverging from master's squashed version at the git-object level (no actual content conflict, just incompatible history). Rebuilding cleanly on current master instead of fighting that.Cherry-picked the one genuinely new commit from that branch and fixed two gaps found in review:
eprintln!wasn't rustfmt-clean — CI'sfmtjob would have failed had it run (it never did on fix: resilient worktree removal on Windows file-lock (#302) #306, blocked by the CONFLICTING status; only CLA/CodeQL/CodeRabbit reported).remove_worktree_dir(retry + backoff,cmd /c rmdirfallback,handle64.exe/handle.exelocking-process detection) had zero test coverage. Added two: a happy-path removal, and a genuine lock-then-release test (opens a file handle, drops it from a background thread after 250ms, asserts the retry loop succeeds within budget) — meaningful on Windows where an open handle actually blocksremove_dir_all; harmless no-op assertion on Unix where it doesn't.Changes (from item #302)
remove_worktree_dir()ingc_orphans: retryremove_dir_allwith exponential backoff (100ms-1.6s, ~3.1s total + one final attempt), fall back tocmd /c rmdir /s /qon Windows, then tryhandle64.exe/handle.exe(Sysinternals, if present — fails gracefully viaCommand'sErrpath if not installed) to report the locking process.cleanup-branches.sh: retrygit worktree removeup to 5x with backoff, distinguish a genuine lock (Permission denied) from dirty/uncommitted (never retried, still skipped immediately), warn and fall through on a persistent lock instead of blocking the rest of the cleanup run.Test plan
cargo test -p flare-git-core— 98/98 pass (2 new)cargo fmt --all -- --check— cleancargo clippy -p flare-git-core --all-targets --all-features -- -D warnings -A unsafe_code -A clippy::pedantic— cleanbash -n scripts/cleanup-branches.sh— syntax valid (shellcheck not available in this environment)Note for reviewers
cmd /c rmdirreceives the worktree path as aCommand::args()element (not shell-concatenated), butcmd.exeitself still parses%...%/&/|inside whatever it receives. Not fixed here — worktree paths in this codebase are always internally constructed fromrepo_root+ a numericsequence_id/branch-derived name, never external/untrusted input, so real-world exploitability is effectively nil. Flagging for the record rather than adding defensive escaping for a threat model that doesn't apply.