Skip to content

fix: await managed-worktree cleanup in lifecycle E2E - #165240

Merged
shakkernerd merged 1 commit into
mainfrom
fix/worktree-gc-e2e
Oct 5, 2026
Merged

shakkernerd merged 1 commit into
mainfrom
fix/worktree-gc-e2e

Conversation

@shakkernerd

Copy link
Copy Markdown
Contributor

Fixes #165232

What Problem This Solves

The managed-worktree session lifecycle E2E still expects worktrees.gc to 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):

  • Focused formatting and type-aware lint: passed in 12.8 seconds.
  • The affected core-test type partition: passed in 30.9 seconds.
  • 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.

@clawsweeper

clawsweeper Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 5, 2026
@clawsweeper

clawsweeper Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 4, 2026, 9:18 PM ET / October 5, 2026, 01:18 UTC.

ClawSweeper review

What this changes

Updates 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
Reviewed head: b83f4804229583a1963df7f46eecf45f9326aa46

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, contract-aligned test repair with preserved lifecycle assertions and reported candidate validation.
Proof confidence 🌊 off-meta tidepool Not applicable: The MEMBER-authored test repair is exempt from the external-contributor proof gate. Its reported Cloud Mac run exercises the real Gateway cleanup owner and isolated checkout lifecycle; the loopback provider is mocked. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The MEMBER-authored test repair is exempt from the external-contributor proof gate. Its reported Cloud Mac run exercises the real Gateway cleanup owner and isolated checkout lifecycle; the loopback provider is mocked. No stored-data contract changes.
Evidence reviewed 9 items Introduced change and merge result: The pinned introduced delta waits on the returned job ID, requires completed state and successful outcome, and adds active-record and fixture-file assertions. The verified test merge has the exact main and head parents and preserves the same focused change.
Authoritative cleanup owner: The maintenance owner returns a queued receipt immediately, reads the existing receipt when given its job ID, and publishes completed or failed state after cleanup. Its implementation is unchanged between the reviewed head and fetched main.
Documented and independently tested contract: The documentation distinguishes background job state from cleanup outcome and specifies polling the same job ID. The existing Gateway handler test separately covers queued, running, and completed readback; the changed E2E protects actual checkout survival and subsequent lifecycle behavior.
Findings None None.
Security None None.

How this fits together

Managed 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]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests +21. Total +21 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 26 5 +21
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 26 5 +21

Review metrics

None.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #165232
Summary: This PR is the focused candidate repair for the linked lifecycle E2E assertion mismatch.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Technical review

Best 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.

Labels

Label changes:

  • add P2: Repairs a concrete lifecycle validation failure without changing production behavior or establishing urgent user impact.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The MEMBER-authored test repair is exempt from the external-contributor proof gate. Its reported Cloud Mac run exercises the real Gateway cleanup owner and isolated checkout lifecycle; the loopback provider is mocked. No stored-data contract changes.

Label justifications:

  • P2: Repairs a concrete lifecycle validation failure without changing production behavior or establishing urgent user impact.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The MEMBER-authored test repair is exempt from the external-contributor proof gate. Its reported Cloud Mac run exercises the real Gateway cleanup owner and isolated checkout lifecycle; the loopback provider is mocked. No stored-data contract changes.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@shakkernerd shakkernerd self-assigned this Oct 5, 2026
@shakkernerd
shakkernerd merged commit e91a316 into main Oct 5, 2026
75 checks passed
@shakkernerd
shakkernerd deleted the fix/worktree-gc-e2e branch October 5, 2026 01:22
@shakkernerd

Copy link
Copy Markdown
Contributor Author

Fixed: the managed-worktree lifecycle E2E now waits for cleanup completion and verifies that the protected checkout remains usable.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 5, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: managed-worktree lifecycle E2E rejects queued GC receipts

1 participant