feat(pr-cycle): 0.5.0 — post-merge worktree sweep (close the agent-worktree leak)#424
Merged
Merged
Conversation
…rktree leak) `/cycle-bg` runs piled up `.claude/worktrees/agent-*` dirs: `gh pr merge --delete-branch` drops the remote branch but leaves the worktree directory, and pr-cycle had no clean step. The pr-cycle-hook's cleanup only ran on Bash-tool `gh pr merge` (not the slash-command !-exec) and only removed the cwd worktree, never accumulated siblings. - after a successful merge, cd to the MAIN worktree, then remove every `.claude/worktrees/agent-*` worktree whose upstream is `[gone]` (+ branch -D + worktree prune) - squash-safe: a squashed branch isn't an ancestor of main, so key off the deleted upstream (`git push -u` then `--delete-branch` leaves it gone), not --is-ancestor - cd-to-main first => even the just-merged CURRENT worktree is swept - SAFETY: never touch a worktree with a live or absent (track=none) upstream (may hold un-pushed work) nor a locked worktree (another checkout); only /.claude/worktrees/ paths are eligible - validated against 9 real leaked worktrees: 2 [gone] + 5 stale-locked swept, 2 track=none (unmerged LAB-10 commits) correctly preserved - g22 lockstep: plugin 0.5.0 <-> marketplace 0.5.0 + CHANGELOG, same commit Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
/cycle-bgruns piled up.claude/worktrees/agent-*dirs:gh pr merge --delete-branchdrops the remote branch but leaves the worktree directory, andpr-cycle had no clean step. The pr-cycle-hook's cleanup only ran on Bash-tool
gh pr merge(not the slash-command !-exec) and only removed the cwd worktree,never accumulated siblings.
.claude/worktrees/agent-*worktree whose upstream is[gone](+ branch -Ddeleted upstream (
git push -uthen--delete-branchleaves it gone), not--is-ancestor
(may hold un-pushed work) nor a locked worktree (another checkout); only
/.claude/worktrees/ paths are eligible
2 track=none (unmerged LAB-10 commits) correctly preserved
Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com