-
Notifications
You must be signed in to change notification settings - Fork 6
t240: Harden worktree auto-cleanup after deploy #978
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Five issues fixed in cleanup_after_merge and cleanup_task_worktree: 1. cleanup_task_worktree: Add runtime file cleanup (.agents/loop-state, .agents/tmp, .DS_Store) before git worktree remove — matches the pattern in worktree-helper.sh cmd_remove that prevents "contains untracked files" errors. 2. cleanup_task_worktree: Fix wt remove invocation — was passing -C flag which wt does not support (unlike git). Now passes path directly. 3. cleanup_task_worktree: Add explicit rm -rf fallback with verification when git worktree remove --force fails silently (corrupted .git file, stale lock, remaining untracked files). 4. cleanup_after_merge: Add verification logging after worktree removal, handle stale DB references (worktree path in DB but directory already gone), and clear branch field in DB after branch cleanup. 5. No-PR shortcut paths: Both cmd_pr_lifecycle (line 7735) and process_post_pr_lifecycle (line 8209) previously skipped worktree cleanup entirely when transitioning no-PR tasks to deployed. Now both call cleanup_after_merge before the transition.
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ✨ 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 |
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
🔍 Code Quality Report�[0;35m[MONITOR]�[0m Code Review Monitoring Report �[0;34m[INFO]�[0m Latest Quality Status: �[0;34m[INFO]�[0m Recent monitoring activity: 📈 Current Quality Metrics
Generated on: Tue Feb 10 19:16:17 UTC 2026 Generated by AI DevOps Framework Code Review Monitoring |
|



Summary
Fixes five issues in the supervisor worktree cleanup pipeline that caused orphaned worktree directories to persist after PR merge and deploy.
Context
After the cmd_transition scoping fix (PR #967), cleanup_after_merge was no longer receiving cross-contaminated worktree/branch values. However, the cleanup itself had several gaps that could still leave worktrees behind.
Changes
cleanup_task_worktree (3 fixes):
cleanup_after_merge (2 fixes):
4. Verification logging + stale DB cleanup — Logs whether removal succeeded. Handles the case where the worktree path exists in the DB but the directory is already gone (cleans up DB reference and registry entry). Also clears the branch field in DB after branch cleanup.
5. No-PR shortcut paths now clean up worktrees — Both cmd_pr_lifecycle (no-PR early return) and process_post_pr_lifecycle (batch no-PR path) previously skipped cleanup_after_merge entirely when transitioning tasks directly to deployed. Now both call it before the transition.
Testing
Closes t240