Repository navigation
fix(worktrees): report retained cleanup failures - #148962
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: needs maintainer review before merge. Reviewed September 21, 2026, 2:48 AM ET / 06:48 UTC (Revision 13). ClawSweeper reviewWhat this changesThe PR reports retained worktree cleanup failures and deferrals through the CLI, Gateway responses, and maintenance logs while preventing repeated removal attempts within one pass. Merge readiness✅ Ready for maintainer review The repair remains useful on current main. The prior inventory, Gateway fixture, and changelog findings are addressed; no remaining actionable defect was found in the pinned patch. Priority: P2 Review scores
Verification
How this fits togetherManaged worktrees provide isolated Git checkouts for agent tasks. Manual and scheduled cleanup use the worktree service to preserve protected checkouts, snapshot eligible work, and report removal results. flowchart TD
A[CLI or Gateway request] --> C[Worktree cleanup service]
B[Scheduled maintenance] --> C
C --> D[Eligibility and protection checks]
D --> E[Snapshot and removal owner]
D --> F[Bounded cleanup report]
E --> F
F --> G[CLI output, RPC result, or health log]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +209, Tests +228. Total +437 across 14 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep one cleanup owner that preserves work and reports incomplete outcomes without inviting automatic retries after committed deletions. Do we have a high-confidence way to reproduce the issue? Yes, from source: an idle worktree whose repository control path is missing can be retained while current main returns ordinary success counts and retries it during limit enforcement. The focused regression models that trigger; this review did not execute it. Is this the best way to solve the issue? Yes. Shared per-pass accounting repairs the existing service and its callers while preserving removal safeguards and the completed Gateway response contract. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against beaf348df230. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (12 earlier review cycles; latest 8 shown)
|
|
@clawsweeper re-review Current head: |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Coordinating adjacent managed-worktree retention presentation work with this canonical GC-outcome repair. The planned change only displays the existing per-record At
There is no planned dependency on the new GC report schema. This PR remains the canonical aggregate cleanup fix; no duplicate replacement is planned. @vincentkoc, please confirm the current active writer and whether this branch is being edited, plus any section or merge-order coordination needed. No source changes have begun for the adjacent retention work. If follow-through on this canonical PR needs a handoff, please identify the existing checkout/evidence owner so useful work and attribution are preserved. Canonical integration follow-throughI am carrying the integration/review follow-through on this existing PR; the original branch and Vincent's attribution remain canonical. No branch writes have been made. Please flag any concurrent branch edits so the exact head can be reconciled before a push. Source comparison: merge base
This is a source/conflict plan, not a completed rebase, test result, or merge recommendation. Execution remains pending the serialized work allocation. Required independent review, exact-head CI, operator/recovery proof, screenshot-delivery verification, and native preparation/landing still apply. |
|
@fuller-stack-dev thanks for preserving the existing PR and evidence. I am the active writer for this landing attempt on Vincent’s behalf. The current remote head is still Your integration notes match the boundaries we need to preserve: main’s lock prefilter and fresh under-lease checks, this PR’s recorded GC progress, both regression sets, and canonical generated outputs from the integrated source. The adjacent per-record retention presentation remains separate; please keep its changes off this branch so the aggregate GC reporting fix has one source owner. I will report the frozen integrated head here after review and push. The other two follow-ups remain separate: #149079 and #149085. Their current CI failures are being attributed before landing; neither is being treated as qualifying proof for this PR. |
|
@vincentkoc I have now received the WDE native source/proof slot after #149193 landed. I saw your 21:12 active-writer notice before any source or branch write. The canonical Please identify the active checkout/operation and any unpublished integrated head so we can adopt that work and avoid duplicate writers. I will preserve your branch-write hold while reconciling custody, and keep the per-record retention patch separate. Baseline/source inspection and focused proof can proceed within the admitted native checkout; no competing push has been made. The existing WDE orchestrator is coordinating the handoff. |
696df53 to
fe22008
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
fe22008 to
73c60aa
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
73c60aa to
2bfa082
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
2bfa082 to
0d33ca9
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
0d33ca9 to
c80caf5
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Merged via squash.
|
What Problem This Solves
Managed worktree cleanup could retain many failed records while reporting a healthy result. The idle pass also tried the same failed worktree again during count or size enforcement, doubling work and producing misleading
limits still exceededlogs.User Impact
Operators now get a bounded per-worktree failure or deferral reason from
openclaw worktrees gc --json. Partial cleanup returns a non-zero CLI status, scheduled cleanup writes a health error, and Gateway callers receive an explicit non-retryable error after any deletions that did succeed.Why This Change Was Made
Each managed worktree ID now receives at most one automatic-removal decision in a GC pass. Failed records stay protected, confirmed removals continue, and up to 64 ID/reason dispositions are returned with a total count when additional results are omitted. The existing three-field Gateway success payload remains unchanged for completed cleanup.
Evidence
tbx_01m30yxdbzb5k2cn22m6wzx8xk: dependency install succeeded; formatter identified two files, then both were formatted with the repository command.c80caf5854d413f240d549adb0425050040eae04.Related: #150940