Repository navigation
fix(worktrees): stop extra eviction after incomplete cleanup - #156876
fuller-stack-dev wants to merge 3 commits into
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed October 8, 2026, 1:05 PM ET / 17:05 UTC (Revision 5). ClawSweeper reviewWhat this changesStops pressure-based worktree deletion when earlier removal accounting is unresolved, rechecks pressure after acquiring cleanup authority, and preserves partial cleanup reports. Example: Cleanup processes two worktrees with maxCount set to 1
Review scores
ProductKind: Bug fix · Worth it: Yes Merge readiness⛔ Blocked before merge - 2 items remain Keep open: this maintainer-authored PR contains useful cleanup safeguards, but GitHub confirms merge conflicts and current main has replaced the affected cleanup architecture. The previous reporting-acquisition finding is fixed; no additional discrete patch defect was established. Priority: P2 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherManaged worktrees give agent sessions separate Git checkouts. Cleanup uses registry records, run leases, and recovery snapshots to decide which checkouts can be removed and report the result. flowchart TD
A[Cleanup request] --> B[Registry and checkout inventory]
B --> C[Count or size pressure]
C --> D[Allocation lease]
D --> E[Recheck pressure and pending removals]
E --> F[Snapshot and remove eligible checkout]
E --> G[Defer unresolved cleanup]
F --> H[Cleanup result]
G --> H
Technical reviewBest possible solution: Carry any still-needed incomplete-removal safeguards into main’s capacity and worker owners, preserving recovery captures and avoiding allocation waits solely for reporting. Do we have a high-confidence way to reproduce the issue? Unclear on current main: the PR records failing native-service regressions on its original production base, but main has since replaced the cleanup path and those scenarios were not rerun here. Is this the best way to solve the issue? Yes for the original invariant: unresolved removal accounting must not justify another eviction. The maintainable integration now belongs in main’s capacity and worker owners rather than restoring the old loop. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 95baa6d9510c. Merge-risk optionsMaintainer options:
Provenance checked
TestingProof path: in-process harness. Added test files: 4. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +206, Tests +615. Total +821 across 11 files. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (4 earlier review cycles)
|
|
Fixed the reporting-lease finding in Four actual held-lease service cases (count/size, under/over cap) failed on the prior head and pass now; they verify preserved checkout bytes and actual expired-snapshot pruning. The three existing retention cases exposed by CI also pass. The complete focused rerun passed 76 selected tests; affected required checks and fresh independent review are clean. Current-head CI is running. |
|
@clawsweeper re-review Current head: dfc8163. The prior reporting-lease finding is addressed with real held-lease red/green regressions and the three existing retention failures now passing; see the disposition above. This requests review only, not merge or autofix. |
|
🦞👀 Re-review progress:
|
|
Closing: current main has replaced the worktree cleanup architecture this PR changed, and the branch conflicts. Any remaining safeguard should be re-authored against current main. |
Related: #148962
What Problem This Solves
Prevents extra worktree eviction when cleanup leaves removal accounting unresolved or pressure falls while GC waits for removal authority.
User Impact
GC pauses pressure-based eviction until incomplete removals reconcile and reports unknown limit compliance instead of trusting stale accounting. A reporting-lease failure returns a deferred/partial result without skipping later maintenance. Recovery snapshots, retention rules, and the bounded public issue schema remain intact; no migration is required.
Why This Change Was Made
Distinguish pending removals from ordinary protected worktrees, preserve initiating and rollback errors, and recheck count/measured-size pressure under the existing allocation lease. Final reconciliation uses the same authority and handles acquisition failures without discarding the GC result.
Evidence
dfc81630cf017a6ee6839eafb866366171ee1f74: 129 successful jobs, 18 workflow-selected skips, no failures; requiredopenclaw/ci-gateis successful.Test cost
The new suites exercise the real service, SQLite authority/claims, native Git deletion, and recovery boundary. Local wall times include wrapper/transform overhead; hosted figures below are sums of logged case durations, not whole-file wall times.
No live cleanup or deployment was performed. The final CI merge candidate includes the now-merged Web Push fix #156824. Earlier task-notification/task-list failures did not reproduce in bounded local replays; their causes were not established or claimed fixed by this PR. Those hosted groups pass on this head. One replay wrapper exited nonzero because auxiliary projects selected no files, despite all selected cases passing; it is not counted as an aggregate-green check.