Repository navigation
fix: preserve unfinished work during completed PR cleanup - #148704
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 14, 2026, 10:58 PM ET / September 15, 2026, 02:58 UTC (Revision 3). ClawSweeper reviewWhat this changesThe PR preserves unfinished files and unpublished branches during completed-PR cleanup while retaining verified local commits needed for safe squash-merge cleanup. Merge readiness✅ Ready for maintainer review The fix remains necessary on current main. The earlier helper-lifetime finding is resolved, and no remaining blocking defect was found. This maintainer-authored PR should proceed through normal merge gates. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s maintainer scripts clean up temporary Git worktrees after PR completion. They combine GitHub status, local ownership checks, and retained merge receipts to decide which directories and branches can be removed. flowchart TD
A[Completed PR] --> B[Cleanup owner]
C[Worktree ownership and local changes] --> B
D[Retained merge receipt] --> B
B --> E{Safe to remove?}
E -->|Yes| F[Non-force Git cleanup]
E -->|No| G[Preserve work and report pending]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceTests +147, Other +50. Total +197 across 8 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep cleanup with the existing owner, using Git’s non-force protections and retained ancestry while reporting preserved work separately from successful merging. Do we have a high-confidence way to reproduce the issue? Yes, source establishes the path: completed-PR cleanup on pinned main uses forced removal without checking unfinished files or unpublished branch ancestry. Execution was not performed in this read-only review. Is this the best way to solve the issue? Yes. The patch strengthens the existing cleanup owner, preserves native Git protections and branch preferences, and extends existing receipt storage without requiring migration. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against e903d3ece751. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (2 earlier review cycles) |
|
Addressed the linked-wrapper GC finding in Receipt helpers now load when the common module initializes, before cleanup can remove its source worktree. Both per-target reloads are gone. The native linked-wrapper GC fixture now removes two eligible worktrees in one invocation and verifies their branches, operation refs, and deferred supervisor release. The regression reproduced the missing-source failure and retained operation locks before the fix. Afterward, 32 related cleanup/native lifecycle/hosted-handoff cases passed, changed-file checks passed, and fresh independent review found no actionable P0/P1 findings. No force, ownership, receipt, or upstream-tracking protection was weakened. The earlier six CI fixture failures also reproduced locally and pass after the preceding fixture correction. The separate subprocess timeouts in unchanged CI files remain recorded; this head still requires a green CI gate before landing. |
|
Merged via squash.
|
…48704) * fix: preserve unfinished work during completed PR cleanup * test: preserve cleanup fixture contracts without forced removal * fix: keep cleanup helpers loaded after linked wrapper removal
* commit 'd8e50a38fd1c4df6dd69bcbc155697c464e1be45': (23 commits) fix(cron): release queued reservations when activation fails (#141008) fix(gateway): reduce CPU work in session lists and searches (#148713) feat(gateway): add admin CPU profile diagnostics (#148004) fix(gateway): cap device-required probe cache to prevent unbounded growth (#147708) fix(ci): align Gateway E2E expectations (#148653) refactor(ai): remove unused overflow wrapper (#148719) feat: stage selected chat text as editable comments (#148649) fix(ci): admit reachable release refs with large histories (#148161) fix(agents): allow authorized email CLI actions (#148521) improve(agents): trim large tool results with less CPU (#148718) refactor(docker): share image version parsing (#148243) fix(ci): retain passing hosted checks after skipped duplicates (#148722) fix(update): report configuration failures during repair (#144819) refactor(imessage): share handle classification (#148229) fix(ui): keep the selected agent across Settings pages (#148667) test(telegram): reuse deferred fixture helper (#148501) fix(media): resize images before understanding (#122431) fix: preserve unfinished work during completed PR cleanup (#148704) refactor(migrate-hermes): reuse canonical config record coercion (#148645) perf(channels): reduce history worker metadata footprint (#148711) ...
What Problem This Solves
Fixes completed-PR cleanup deleting uncommitted files and unpublished local branch tips when a task merges or closes.
Related: #147527, which established the existing exact-worktree ownership checks.
User Impact
Maintainers keep unfinished work. Clean completed checkouts still clean up, including ignored build artifacts. Reviewed squash-merge branches can be retired using their retained completion receipt, including a local prepared commit whose published GitHub commit has a different ID. Existing branch tracking stays unchanged.
Dirty, locked, ambiguous, or unpublished work produces a visible cleanup-pending result. GitHub merge success remains separate from local cleanup success.
Why This Change Was Made
The previous cleanup used forced Git removal after validating ownership. Those checks do not establish whether new local work was added. Cleanup now uses native non-force Git operations. The same worktree eligibility check serves garbage-collection previews and actual removal. Retained merge receipts provide the source ancestry needed for squash cleanup without bypassing Git's checked-out-branch protections.
Evidence
No Gateway deployment, public config change, new dependency, or forced production cleanup. Older merge receipts remain readable; if they cannot prove a local branch was published, cleanup retains that branch.