Repository navigation
fix: await managed-worktree cleanup in lifecycle E2E - #165240
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 October 4, 2026, 9:18 PM ET / October 5, 2026, 01:18 UTC. ClawSweeper reviewWhat this changesUpdates the managed-worktree lifecycle E2E test to await queued cleanup completion and verify that the session-owned checkout survives. Merge readiness✅ Ready for maintainer review The repair remains necessary on current main and preserves the lifecycle scenario’s meaningful checks. No introduced correctness or security defect was found; this member-authored PR should remain open. Priority: P2 Review scores
Verification
How this fits togetherManaged worktrees are Git checkouts owned by OpenClaw sessions. The Gateway queues cleanup through its maintenance owner, and this E2E scenario verifies checkout protection, deletion snapshots, restoration, and foreign-lock preservation. flowchart TD
A[Session lifecycle scenario] --> B[Gateway cleanup request]
B --> C[Maintenance owner]
C --> D[Queued job receipt]
D --> E[Observe terminal job state]
E --> F[Verify checkout survival]
F --> G[Verify deletion and restoration]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceTests +21. Total +21 across 1 file. View PR surface stats
Review metricsNone. Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Keep the existing queued cleanup contract and make lifecycle proof inspect successful completion before verifying checkout preservation and recovery. Do we have a high-confidence way to reproduce the issue? Yes, source inspection establishes the mismatch: current main expects an exact immediate summary while the production owner returns a queued receipt. The related issue supplies a failing CI trace; no runtime reproduction was executed during this review. Is this the best way to solve the issue? Yes, observing the existing job’s terminal state is the narrow repair, and the added record and file checks prevent retained snapshot metadata from masquerading as checkout survival. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against a2affcf76e93. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Fixed: the managed-worktree lifecycle E2E now waits for cleanup completion and verifies that the protected checkout remains usable. |
Wait for the managed-worktree cleanup receipt to complete before checking lifecycle results, and verify that the session-owned checkout remains active and readable. Fixes openclaw#165232.
Fixes #165232
What Problem This Solves
The managed-worktree session lifecycle E2E still expects
worktrees.gcto return a finished three-field summary. The RPC now returns a queued maintenance receipt, so the test fails before it can verify cleanup, restoration, and lock preservation.User Impact
Restores CI proof that a session-owned checkout survives GC and remains recoverable through the existing deletion and restore flows. Product behavior is unchanged.
Why This Change Was Made
Follow the returned job ID until the maintenance owner reaches a terminal state, then require successful completion before inspecting the cleanup summary. Preserve the existing removal counters and all clean/dirty snapshot, restored-file, branch-history, and foreign-lock assertions.
Also verify that the post-GC record is still active and its fixture file exists: the public worktree list can retain removed records with snapshots, so ID and owner alone do not prove checkout survival.
Evidence
The existing failed Gateway E2E job shows the queued receipt. Its relevant test and RPC contract are unchanged through the selected main baseline.
The exact candidate passed on the Cloud Mac (Node 24.21.0, pnpm 12.5.1):
node scripts/run-vitest.mjs run --config test/vitest/vitest.e2e.config.ts test/e2e/qa-lab/runtime/managed-worktrees-session-lifecycle-product-proof.e2e.test.ts: 1/1 passed; scenario 18.5 seconds, command 559.7 seconds including a fresh native prerequisite build.This existing E2E case exercises the real Gateway RPC with a loopback mock provider and an isolated Git repository; no live provider or user state is involved. It adds no cases or CI jobs. The historical failing case took 12.3 seconds before stopping at the obsolete assertion; the complete repaired case took 18.5 seconds on the Cloud Mac, so these are different hosts and execution paths, not a performance comparison. Independent source review and repository autoreview are clean. Normal hosted PR checks remain required before landing.