storkit: create 364_bug_worktree_cleanup_loops_on_orphaned_directories
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
---
|
||||
name: "Worktree cleanup loops on orphaned directories"
|
||||
---
|
||||
|
||||
# Bug 364: Worktree cleanup loops on orphaned directories
|
||||
|
||||
## Description
|
||||
|
||||
When a git worktree becomes orphaned (directory exists but git no longer recognises it as a valid worktree), the periodic worktree cleanup retries `git worktree remove` every minute and fails repeatedly with "fatal: not a working tree". This spams the logs indefinitely.
|
||||
|
||||
## How to Reproduce
|
||||
|
||||
1. Have a worktree created via storkit (e.g. for spike 329 or story 359)
|
||||
2. The worktree becomes orphaned — git refs break but the directory remains
|
||||
3. Observe server logs repeating the "not a working tree" warning every minute
|
||||
|
||||
## Actual Result
|
||||
|
||||
Cleanup loops forever, logging "fatal: '/workspace/.storkit/worktrees/...' is not a working tree" every minute without resolving the issue.
|
||||
|
||||
## Expected Result
|
||||
|
||||
If `git worktree remove` fails because git doesn't recognise the directory as a worktree, fall back to removing the orphaned directory directly (rm -rf) and clean up any stale git worktree metadata.
|
||||
|
||||
## Acceptance Criteria
|
||||
|
||||
- [ ] Orphaned worktree directories (exist on disk but not in git worktree list) are detected and removed
|
||||
- [ ] Removal fallback uses rm -rf when git worktree remove fails with 'not a working tree'
|
||||
- [ ] Stale .git/worktrees entries are pruned (git worktree prune)
|
||||
- [ ] No repeated log spam for the same orphaned worktree
|
||||
Reference in New Issue
Block a user