Repository navigation
Description
Summary
infra/worktree-reaper/bin/worktree_reaper.py detects a worktree whose directory has already been deleted — evaluate_tree returns action stale-registration (worktree_reaper.py:417) — but nothing ever removes that registration. The only git worktree prune call in the script (worktree_reaper.py:599-600) is gated on removed_any, which is set only when a candidate tree is successfully reaped in the same primary in the same run (worktree_reaper.py:570, :584). A primary whose only dead trees are already-deleted directories therefore accumulates stale registrations forever: every run logs them as kept (stale-registration) and exits 0. The parser even records git's prunable flag (worktree_reaper.py:182, :194-195) and no code ever reads it.
Evidence (verified this run, laptop primary at origin/main 2bcd46e)
Probe ~/git/fleet/probe-reaper-stale/probe.py drives the real worktree_reaper.main() (in-process, --no-fetch, temp config/state under the probe dir) against a scratch primary:
- Create a linked worktree
wt1, then delete its directory out from under git (the fleet reality this tool exists for: trees removed by hand, by a crashed cleaner, or by a disk cleanup). git worktree list --porcelainbefore: thewt1path is present and markedprunable.- Run the reaper (not dry-run): exit 0; summary
evaluated: 1, candidates: 0, reaped: 0, kept: {"stale-registration": 1}. git worktree list --porcelainafter the reaper: the stale registration is still present.- Control: a manual
git worktree prunein the same primary removes it immediately — the remedy exists and works; the reaper just never invokes it on this path.
Why it matters
The reaper is the fleet's only automatic worktree hygiene (README: born when the standing population grew 187 → 1,511 in five days). Stale registrations are the cheapest dead trees to clear — no gates, no content at risk, the directory is already gone — yet they are the one class it can never clear on its own. They pile up in git worktree list, in the reaper's own evaluated/kept counts every run, and in any other tooling that iterates registered worktrees, and they only disappear if some other, unrelated tree happens to be reaped in the same primary in the same run (the removed_any side effect) or a human prunes by hand.
Acceptance criteria
- A run that finds a stale registration in a primary (and is not
--dry-run) leaves that primary with the registration pruned, even when no candidate tree was reaped in that primary. --dry-runstill changes nothing on disk, and stale registrations found in dry-run are reported as would-prune (or an equivalent explicit action), not silently folded into kept counts.- Prune remains fail-safe: it runs only for primaries that were successfully inventoried this run (the existing fail-closed fetch/list behaviour is unchanged), and a prune failure is surfaced in the run summary/errors rather than swallowed.
- Existing gate semantics are untouched: primaries are never reaped, locked/denied/dirty/unpushed trees keep exactly as today; the post-reap prune behaviour for candidate reaps is preserved.
- Regression coverage in
infra/worktree-reaper/tests/test_worktree_reaper.py: a primary whose only worktree is a deleted-directory (prunable) registration is pruned by a non-dry-run pass, and is untouched by a dry-run pass.
Distinct from
- Issue worktree-reaper: config is never validated — typo'd deny_* keys and string-typed values silently disarm the denylist, wrong-shaped config crashes with a raw traceback #6394 (worktree-reaper config validation), issue ci(worktree-reaper): test_worktree_reaper.py is run by no workflow — the destructive reap gates are verified nowhere #5946 / issue ci(worktree-reaper): run safety-gate tests #6357 (the reaper's test suites have no CI venue), issue worktree-reaper: fail closed when /proc cannot be scanned before removal #5740 (fail closed when /proc cannot be scanned). None covers the stale-registration/prune path.
Activity
developing-today commentedon Nov 6, 2026
CODE-1989
dezren39 commentedon Nov 6, 2026
🤖 Agent note · filed
git worktree prunecontrol removed it immediately.dezren39 commentedon Nov 6, 2026
🤖 Agent note · handed off to opencode claimant
40 remaining items
dezren39 commentedon Nov 10, 2026
🤖 Agent note · handed off
dezren39 commentedon Nov 10, 2026
🤖 Agent note · handed off
dezren39 commentedon Nov 10, 2026
🤖 Agent note · handed off (task 13120, lane code-k)
dezren39 commentedon Nov 10, 2026
agent-note:v1
lane: code-w
task: 11393
issue: #6547
stage: handed_off
note: Task 11393 (small_fix, issue #6547) handed off to the opencode claimant: lane assignment row 3661 is opencode (re-confirmed this claim). Issue #6547 OPEN, no hard-stop labels, no status/needs-triage (fresh, lane code-w 2026-11-10). Attempts 4/6. Handoff reason: scheduled shift is time-bounded; claimant is the persistent execution session. Next: claimant launches the bound opencode session.
Merge pull request #8700 from developing-today/queue/11393-6547-reape…
dezren39 commentedon Nov 11, 2026
Agent note — task 11393 done (fixed_merged)