B12 — Worktree hard-release on mismatch (close F1 — silent stall) #428
Labels
No labels
area:agents
area:dashboard
area:database
area:design
area:design-review
area:flows
area:infra
area:meta
area:security
area:sessions
area:webhook
area:workdir
security
type:bug
type:chore
type:meta
type:user-story
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
charles/claude-hooks#428
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
As an orchestrator,
I want the workdir helper to forcibly release a worktree on branch mismatch and re-acquire,
so that the silent-stall pattern of "release first, then nothing" goes away.
Today the
[workdir] worktree at .../dev%2FN is on branch dev/M, expected dev/N — release firstlog is a notice, not a recovery. The handler doesn't actually release the mismatched worktree before the calling task moves on. Three back-to-back rebase dispatches all hit this last night when the previous task left the worktree on a sibling branch.Acceptance criteria
Hard release
acquireWorktree(target_branch)finds the path checked out to a different branch, rungit worktree remove --force <path>thengit worktree add <path> <target_branch>.worktree-recovery/<sha>branch first, log a warning, then force-remove. The stash branch is kept for 24 h then GC'd.Timeout
WorktreeAcquireTimeout(caught by the existing retry path).Logging + GC
[workdir] hard-release at <path> from <branch> to <target> (recovered N uncommitted lines).worktree-recovery/*branches older than 24 h.Tests
worktree-recovery/<sha>, then force-remove + re-add, warning logged.WorktreeAcquireTimeout.Out of scope
References
docs/specs/automation-hardening.md§4 B12.apps/server/src/infrastructure/workdir/.