feat: run automatic worktree cleanup#429
Conversation
Generated-By: looper 0.8.1 (runner=worker, agent=codex)
mrcfps
left a comment
There was a problem hiding this comment.
@Siri-Ray Thanks for shipping the cleanup loop and the new status/event coverage. I found one blocking issue in the candidate selection path that can prevent newer eligible worktrees from ever being cleaned once older skipped entries accumulate.
🔁 Powered by Looper · runner=reviewer · agent=opencode · An autonomous AI dev team for your GitHub repos.Generated-By: looper 0.8.1 (runner=fixer, agent=codex)
|
@Siri-Ray I'm holding off on generating review comments for #429 because this pull request has merge conflicts right now. Please resolve the conflicts with main and push the updated branch. Once that's done, request or wait for the review to run again and I'll take another look. 🔁 Powered by Looper · runner=reviewer · agent=opencode · An autonomous AI dev team for your GitHub repos. |
Generated-By: looper 0.8.1 (runner=fixer, agent=codex)
|
Looper fixer round complete — 67bcd6a
🔁 Powered by Looper · runner=fixer · agent=codex · An autonomous AI dev team for your GitHub repos. |
mrcfps
left a comment
There was a problem hiding this comment.
@Siri-Ray Thanks for the quick follow-up on the starvation fix and for adding regression coverage. I reran go test ./... on 67bcd6a and found one remaining blocker in the automatic cleanup path: it still bypasses the configured retention/orphan policy, so the daemon can delete fresh checkouts much earlier than daemon.worktreeCleanup promises.
Generated-By: looper 0.8.1 (runner=fixer, agent=codex)
|
Looper fixer round complete — 4d42575
🔁 Powered by Looper · runner=fixer · agent=codex · An autonomous AI dev team for your GitHub repos. |
mrcfps
left a comment
There was a problem hiding this comment.
@Siri-Ray Thanks for wiring the cleanup loop through the planner and for adding coverage around retention/orphan policy. I reran go test ./... on 4d42575 and found one remaining blocking lifecycle hole in the current-state revalidation before deletion.
Generated-By: looper 0.8.1 (runner=fixer, agent=codex)
|
Looper fixer round complete — 90eb2ce
🔁 Powered by Looper · runner=fixer · agent=codex · An autonomous AI dev team for your GitHub repos. |
794c9da to
e031c7f
Compare
Generated-By: looper 0.8.1 (runner=fixer, agent=codex)
e031c7f to
d6f5264
Compare
mrcfps
left a comment
There was a problem hiding this comment.
@Siri-Ray I reviewed the automatic worktree cleanup loop, the follow-up revalidation fixes, the new status/API surface, and the ignored-file handling change, and I reran env -u LOOPER_CONFIG go test ./... on d6f5264. Everything I checked lines up with the intended retention/queue-safety behavior now. Thanks for sticking with the follow-up fixes here — this looks solid.
Summary
looperd, gated bydaemon.worktreeCleanup.enabled.git worktree listbefore using the existing safegit worktree removecleanup path.Safety and behavior
dirty_git_status; ignored files do not block cleanup.git worktree list.maxPerTick, and records per-candidate failures without failing daemon startup or scheduler execution.Authority and trade-off
The authority for deleting a checkout is the persisted worktree record after immediate revalidation against current SQLite state and
git worktree list, plus cleangit status; this is not based on agent output because checkout removal is daemon maintenance over persisted runtime state, not an agent-declared action.This adds only in-memory cleanup status plus existing event-log audit records; the cost is another daemon maintenance loop and status surface, but it avoids a new durable cleanup ledger while still making cleanup observable and best-effort.
Validation
env -u LOOPER_CONFIG go test ./...env -u LOOPER_CONFIG go vet ./...env -u LOOPER_CONFIG go build ./...Closes #426
🔁 Powered by Looper · runner=worker · agent=codex · An autonomous AI dev team for your GitHub repos.