Repository navigation
fix: preserve uncertain Git cleanup after cancellation - #184226
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. What this changesThis PR preserves late Git cleanup uncertainty after cancellation and retains temporary snapshot artifacts when cleanup cannot be confirmed. Example: The native-buffered-settlement snapshot is cancelled while a buffered SIGTERM result awaits delivery.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR fixes a current recovery-safety defect and resolves the earlier buffered-producer concern without an actionable finding. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe Git worker host brokers worker requests to parent-owned Git executors, joins admitted callbacks, and returns operation results while managing temporary snapshot directories. flowchart TD
A[Worktree lifecycle caller] --> B[Git operation host]
B --> C[Git worker]
C --> B
B --> D[Native command executors]
D --> E[Cleanup outcome]
E --> B
B --> F[Caller error and retained artifacts]
Technical reviewBest possible solution: Land the host-owned cleanup classification and artifact-retention repair alongside the already-merged buffered producer correction. Do we have a high-confidence way to reproduce the issue? Current-main source establishes discarded late replies and unconditional artifact deletion; the reported red/green lifecycle regressions match those paths, but this read-only review executed no tests. Is this the best way to solve the issue? The repair uses the existing Git host, canonical cleanup classifier, and finalizer, preserving uncertainty without changing generic worker semantics or introducing another recovery owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 1b6eb7bf2e7f. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +41, Tests +246. Total +287 across 4 files. Added test files: 2. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes:
Label justifications:
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 (1 earlier review cycle)
Reviewed October 26, 2026, 5:55 AM ET / 09:55 UTC (Revision 2). |
af80aa5 to
fe76255
Compare
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
fe76255 to
c56fefc
Compare
|
Fixed: cancelled Git operations preserve uncertain cleanup outcomes and recovery artifacts. |
Preserve late Git cleanup uncertainty after cancellation and retain temporary artifacts needed for recovery. Fixes openclaw#184197.
Preserve late Git cleanup uncertainty after cancellation and retain temporary artifacts needed for recovery. Fixes #184197. (cherry picked from commit 8b3f7a9) Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit e801897a63034ee6c14a2ade31615e19409da17c)
Preserve late Git cleanup uncertainty after cancellation and retain temporary artifacts needed for recovery. Fixes #184197. Beta.5 baseline adaptation: Retain the native beta.5 owners, fixtures and public contracts; add focused regression controls and bounded fixture extraction; apply checkout formatting. (cherry picked from commit 8b3f7a9) (cherry picked from commit ca43a38) Co-authored-by: Peter Steinberger <[email protected]> Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit f4776983fc8cec2b9c2bcbc13f564a11f7e02094)
What Problem This Solves
Cancelling workspace preparation can hide an uncertain native Git cleanup outcome. The host waits for its admitted Git command, but a worker that has stopped accepting replies leaves the caller with the earlier ordinary cancellation. The snapshot cleanup path also removes its temporary directory after a canonical cleanup error. Both behaviors discard information needed to preserve unfinished work for recovery.
Fixes #184197.
User Impact
The Git host now preserves cleanup uncertainty supplied by its executors after cancellation and leaves its temporary artifacts intact when native cleanup cannot be confirmed. Confirmed-clean cancellation, ordinary command errors, authorization checks, and successful operations keep their existing behavior. This restores the existing recovery contract without adding configuration, persistent state, or a retry policy.
Why This Change Was Made
The Git host already owns native execution and joins outstanding callbacks. It now retains the first canonical cleanup failure independently of worker reply delivery, including callbacks that have already left the outstanding-work set. After joining admitted host work, it reports that failure before deleting temporary artifacts.
The host checks the two existing transport forms directly: text results carry a cleanup status, while buffered results can carry a canonical or privately recorded cleanup error. The normal worker error envelope and generic process and worker APIs stay unchanged. Existing lifecycle fixture helpers move into a test-support module so the regression cases fit the test-file limit without removing assertions or changing timeouts.
Evidence
Six callback/artifact cases fail on the original Git host and pass with this change: three late text cleanup reports, two late buffered cleanup errors, and retained snapshot artifacts after a consumed cleanup exception. These cases use real workers and Git commands, with controlled cleanup reports to cover each result form.
Independent review also found that the lower buffered adapter discarded resolved cleanup uncertainty. That producer correction landed in #184270 and is included in this branch. A new coupled regression uses the real buffered adapter and native runner, a self-terminating child, and the actual snapshot worker. It holds the unchanged native result across worker cancellation, then checks caller settlement, canonical uncertainty, retained temporary ownership, and absence of snapshot publication. This case fails with the producer correction alone and passes with the Git-host repair. It does not inject a result above the adapter or claim to reproduce an escaped operating-system process. The native self-signal fixture runs on POSIX; Windows is explicitly excluded from that fixture.
Remote validation passed changed-source formatting/lint, all selected production/test type groups, and 344 tests across 24 affected files, with one existing skip. The related batch took 183 seconds and includes ordinary cancellation/restart, authority checks, successful Git operations, worktree hydration, and snapshot cleanup controls. The committed tree matches the tested tree.
The integrated result passed independent review and hosted CI. A later upstream snapshot-preparation change required aligning the native fixture with the remaining capacity callback; the production repair and assertions are unchanged. The targeted refresh passed formatting/lint, core and infrastructure test types, and all 30 cases in the two affected lifecycle files. Current-head CI and the same independent reviewer passed that adaptation. A shipped CLI cancellation capture is not included. Shared default-base recovery remains a separate contribution.