Repository navigation
fix(cloud-workers): make Crabbox provisioning idempotent - #121019
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 9, 2026, 2:48 PM ET / 18:48 UTC. ClawSweeper reviewWhat this changesThe PR replaces slug-based Crabbox lease recovery with a deterministic fixed lease ID so Gateway retries reconcile the same worker after a lost response or restart. Regression provenancePossible regression — probable (reviewed change; failure trace). No predecessor PR is attributed. Merge readinessKeep this maintainer-authored, protected PR open. The fixed-ID design addresses a real current-main allocation gap, but merging before a released Crabbox CLI supports the contract would break existing cloud-worker setups. Priority: P1 Review scores
Verification
How this fits togetherGateway persists a cloud-worker provision operation and delegates allocation to the bundled Crabbox provider plugin. The plugin invokes the local Crabbox CLI, then Gateway records and later inspects or destroys that lease. flowchart LR
A[Gateway provision request] --> B[Durable worker environment]
B --> C[Crabbox provider plugin]
C --> D[Fixed lease ID warmup]
D --> E[Crabbox coordinator]
E --> F[Lease inspection and adoption]
F --> G[Ready worker or visible failure]
Decision needed
Why: The change intentionally raises the runtime CLI requirement; only maintainers can authorize dependency publication or accept an upgrade-breaking requirement. Before merge
Agent review detailsSecurityNone. PR surfaceSource +3, Tests +129, Docs +2. Total +134 across 7 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Publish and verify the Crabbox release that supports fixed lease IDs, then confirm the released CLI’s warmup/replay behavior and exact-head CI before merging. Do we have a high-confidence way to reproduce the issue? Yes, source establishes the replay path and the PR describes a managed-coordinator lost-response/restart run; this read-only review did not independently execute the released dependency contract. Is this the best way to solve the issue? Yes, conditionally: a fixed durable lease identity at the provider boundary is preferable to slug adoption, but it must wait for the released CLI contract. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against e86512f93b0d. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
Land-ready proofFinal reviewed head: The external dependency gate is resolved and public:
The published assets are byte-identical to the signed candidate and the protected verifier executed the arm64 and x86_64 artifacts successfully. The release owner explicitly accepts the visible fail-closed upgrade behavior for interrupted legacy unleased The existing managed-AWS proof remains the behavior proof: the first fixed-ID warmup committed, its response was withheld until OpenClaw timed out, the isolated Gateway restarted against the same SQLite state, and replay adopted the same single lease. It reached ready, then destroy moved it to released with zero active matching inventory. Final verification:
The current-main sync preserved the Desktop capability in the shared warmup builder and changed no product behavior beyond composing it with the fixed-ID contract. There is no remaining dependency, live-behavior, CI/Testbox, security, or review proof gap. |
|
Merged via squash.
|
…1019) * fix(cloud-workers): make Crabbox provisioning idempotent * fix(crabbox): preserve desktop fixed-id warmups
What Problem This Solves
Fixes an issue where a cloud-worker provision operation could create a second Crabbox lease after the Gateway restarted or lost the successful
warmupresponse. OpenClaw previously treated a deterministic slug as ownership, but direct AWS may suffix occupied slugs, so slug probing and adoption could not provide atomic idempotency.This PR is deliberately separate from #120715. It consumes the fixed lease ID contract landed by openclaw/crabbox#1261.
Why This Change Was Made
OpenClaw now derives one domain-separated canonical
cbx_plus 12-lowercase-hex lease ID from the durable provision operation and passes it to exactly one fixed-ID warmup. Provision operations use the versionedprovision:v2:<64hex>form; an interrupted legacyprovision:<64hex>row fails visibly before allocation because it cannot be reconciled safely. Existing lifecycle rows that already store a lease ID continue normally.The deterministic slug remains display metadata only. Provisioning no longer probes, owns, adopts, or cleans up by slug, and it no longer parses an arbitrary lease ID from warmup output. Inspect and stop target only the canonical ID. Transient or ambiguous inspect/cleanup failures leave the fixed lease available for durable Gateway replay; permanent unusable results clean up the exact ID before surfacing. The production TypeScript diff is +125/-124 lines.
User Impact
Repeating the same durable Crabbox provision operation across Gateway restarts cannot allocate a replacement lease. A committed lease whose response was lost is reconciled through the same canonical identity, while drift, terminal reuse, unsupported fixed identity, and unsafe legacy replay fail closed and visibly.
Merge blocker: Crabbox 0.41.1 is the documented minimum, but that release does not exist yet. Releasing or publishing Crabbox requires owner authorization. Do not merge this PR until a Crabbox release containing the landed fixed-ID contract is available; this PR does not claim that 0.41.1 has been released.
Evidence
CI=1 node scripts/check-changed.mjs -- <all seven changed files>passed.node scripts/tsdown-build.mjsinvocations.Live proof on 2026-08-09 used a real managed Crabbox AWS coordinator. The first warmup committed and its response was withheld until OpenClaw timed out; the durable row remained provisioning with one canonical lease,
cbx_f9b3e3fff81a. After restarting the Gateway against the same isolated state, startup replay used the same operation and adopted the same single EC2 resource. The environment reached ready, and OpenClaw destroy moved the lease to released with zero active matching inventory.The live proof used no Tailscale and no instance profile, allowed only the explicit Gateway
/32, kept OpenClaw state isolated, and completed cleanup. No EC2 instance identifier is included here.AI-assisted: yes. The implementation and final review used Codex; the behavior, dependency boundary, focused tests, and live proof were independently inspected before publication.