Repository navigation
fix(crabbox): don't wait for optional teardown capture - #168454
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 real behavior proof before merge. What this changesThis PR returns from destruction when optional Crabbox capture is claimed and preserves readable session-change error details. Example: Reclaim an AWS cloud session whose optional image capture takes the reported 880 seconds.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 5 items remain Keep open: responsive reclaim is valuable, but claimed captures still acknowledge destruction before confirmed stop and can leave a paid lease outside Gateway cleanup retries. Priority: P1 Before merge
Findings
Tests
Agent review detailsHow this fits togetherThe Gateway environment lifecycle calls the Crabbox provider with a lease identity and interprets successful destruction as confirmed physical teardown. flowchart TD
A[Session reclaim] --> B[Environment lifecycle]
B --> C[Revoke worker authority]
C --> D[Crabbox provider destroy]
D --> E[Optional image capture]
E --> F[Lease stop]
D --> G[Terminal cleanup settlement]
Technical reviewBest possible solution: Return reclaim admission promptly through the existing environment lifecycle owner while retaining destruction settlement through confirmed stop and retryable cleanup failure. Do we have a high-confidence way to reproduce the issue? Current main awaits capture before stop, matching the reported delay; the introduced race and unchanged lifecycle caller establish premature cleanup settlement without running target code. Is this the best way to solve the issue? Detaching only claimed capture preserves skipped-capture errors, but provider fulfillment still violates the confirmed-teardown contract. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against e40606fdea96. Merge-risk optionsMaintainer options:
Copy recommended automerge instructionProvenance checked
TestingProof path: in-process harness. SecurityNeeds attention: Credential revocation remains, but early destruction acknowledgment releases physical-stop custody before retired-worker isolation is established. EvidenceSecurity concerns:
What I checked:
PR surfaceSource +17, Tests +145. Total +162 across 16 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes: No label 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 (10 earlier review cycles; latest 8 shown)
Reviewed October 10, 2026, 4:16 PM ET / 20:16 UTC (Revision 11). |
810b3bd to
c5029fa
Compare
|
Merged via squash.
|
* fix(crabbox): detach optional teardown capture from reclaim * fix(crabbox): await teardown when capture is skipped * test(crabbox): preserve the observer store generic * refactor(crabbox): simplify optional teardown handling
Environment status projected the record state while destroy was requested, so a worker read ready/available for the 40-120 s of lease stop. Status now reports stopping while cleanup is pending (worker.state stays the raw lifecycle state). The 600 s stop timeout in the issue was already fixed by #168454, which detaches an optional teardown capture. Fixes #170144
…law#174768) Environment status projected the record state while destroy was requested, so a worker read ready/available for the 40-120 s of lease stop. Status now reports stopping while cleanup is pending (worker.state stays the raw lifecycle state). The 600 s stop timeout in the issue was already fixed by openclaw#168454, which detaches an optional teardown capture. Fixes openclaw#170144
What Problem This Solves
After #168371, empty-workspace AWS sessions use Crabbox's teardown warm-image capture. Waiting for that optional capture made
sessions.reclaimtake a measured 880 seconds. Reclaim must stop waiting only when an optional capture is actually claimed; all other teardown failures must remain retryable by the Gateway.User Impact
Only a claimed optional capture detaches. Capture stays at teardown and still precedes lease stop. Disabled capture, unenrolled allocations, up-to-date images, retained refusals, and other skipped captures retain synchronous stop and propagate its original error.
The provider's capture-failure and stop-failure warning strings directly name the lease and the next-step
crabbox stop --provider <provider> <lease>command. Session-change warnings retain the existing redacted message/code formatting fix.Why This Change Was Made
The existing capture owner signals after its guards and successful claim. Destroy waits for either that signal or completed teardown. A plain local boolean records whether capture started; there is no AsyncLocalStorage or logging context. The original project-preparation constant, provisioning methods, and inline timeout methods are restored.
crabbox-worker-timeouts.tshas no change from the PR base, and no timeout values changed.Accepted edge case: if the Gateway process exits while detached capture is running, OpenClaw does not stop the lease; Crabbox's idle timeout / TTL reaps it. There is no new durable state, restart recovery, or core lifecycle machinery.
Evidence
Final full-PR diff: 16 files, +244/-82. Production diff against the PR base:
crabbox-worker-provider.tscrabbox-worker-warm-image-capture.tssession-change-event.tsThe capture file retains only the two-line
onCaptureStarthook. The timeout module is unchanged.pnpm test <11 focused files> --maxWorkers=1: 284 tests passed in 188.05 s wall time. This includes all previously failing preflight, plugin lifecycle, allocation-authority, and recovery-event files, plus stop, provider, desktop, cancellation, stop-lifetime, warm-image, and warm-image-lifecycle coverage. The held-capture regression took 630 ms.pnpm tsgo:extensionsandpnpm tsgo:extensions:testpassed. Formatting andgit diff --checkpassed. Independent Codex review of the staged full candidate was scoped-clean at P0/P1.Earlier CI failures were fixed by restoring behavior, not weakening assertions: preflight and classless lifecycle expectations are unchanged. The fork fixture waits for the seed's real capture/lease-release write before asserting a fork. The recovery-event test expects the intended formatted error string. The seed observer has an explicit generic store return type; its exact CI type configuration and allocation tests passed in the preceding correction.
Exact-head CI on
b9f08b89664190acf2ac0be21bb761257de57daf: run 38081765268 is green.timeout 40m node scripts/watch-pr-ci.mjs 168454 <head>completed successfully in 393.79 s.No live Gateway was changed or restarted. This PR remains open and unmerged.