Repository navigation
feat(crabbox): opt-in profile warm images for cloud workers - #130087
Conversation
Evaluates dormant leases, checkpoint-based warm start, and serverless backends for a worker-environment hibernation tier; proposes a plugin-only phase 1 (Crabbox checkpoint fork warm images) with SDK/store phases gated on maintainer acceptance.
The 60s command bound starved the scrub and checkpoint-create phases under coordinator latency, silently degrading every teardown to cold-only. Live-measured on AWS.
Phase 1 live-proven: local-container full loop (cold 101s vs warm fork 40s, scrub boundary verified) and AWS cold provisioning with graceful degrade at the coordinator admin gate; named upstream follow-ups.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: found issues before merge. Reviewed August 26, 2026, 8:41 AM ET / 12:41 UTC. ClawSweeper reviewWhat this changesThis PR adds an opt-in Merge readinessKeep open: the warm-image lifecycle can orphan billed checkpoints during stale-reservation recovery, and desktop browser state is outside the checkpoint scrub boundary. Priority: P1 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherCloud-worker profiles drive Crabbox allocation, setup, node enrollment, and teardown. The new plugin-owned image index sits between teardown and later allocation, while each restored worker still performs fresh enrollment. flowchart LR
A[Cloud worker profile] --> B[Allocate lease]
B --> C[Warm checkpoint fork or cold setup]
C --> D[Fresh node enrollment]
D --> E[Worker session]
E --> F[Scrub and checkpoint]
F --> G[Warm image index]
Before merge
Findings
Agent review detailsSecurityNeeds attention: The desktop warm-image path can preserve prior browser-profile data across worker sessions. PR surfaceSource +422, Tests +591, Docs +314. Total +1327 across 6 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the feature plugin-local, but make reservation promotion owner-conditional with cleanup for a losing creator, and either scrub all desktop browser state or reject desktop warm images until that boundary is proven safe. Do we have a high-confidence way to reproduce the issue? Yes for the review findings: a controlled two-manager test can hold the first capture past the 360-second recovery threshold and show its later promotion displacing the second record; a desktop profile can assert the browser-cache path is absent before checkpointing. Is this the best way to solve the issue? No: plugin-local checkpointing is the right boundary, but the present recovery and scrub implementations do not preserve the claimed single-flight and cross-session isolation invariants. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 1e6844b71aa2. LabelsLabel changes:
Label justifications:
EvidenceSecurity concerns:
What 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
HistoryReview history (2 earlier review cycles)
|
Delete least-recently-used provider snapshots before image index admission. Recover stale empty capture reservations without breaking single-flight. Persist effective machine classes across restarts and revert heartbeat coupling. Align the hibernation plan with the exact-class warm-image key policy.
|
All four review findings are addressed in
On the remaining merge-risk note about the uninspectable Crabbox contract: the companion PR landed — openclaw/crabbox#1526 (
|
|
Merged via squash.
|
…#130087) * docs(plan): add worker hibernation design note Evaluates dormant leases, checkpoint-based warm start, and serverless backends for a worker-environment hibernation tier; proposes a plugin-only phase 1 (Crabbox checkpoint fork warm images) with SDK/store phases gated on maintainer acceptance. * feat(crabbox): add opt-in profile warm images * fix(crabbox): preserve warm image machine class * refactor(crabbox): tighten warm-image seams after review * fix(crabbox): budget warm-image capture for real snapshot round trips The 60s command bound starved the scrub and checkpoint-create phases under coordinator latency, silently degrading every teardown to cold-only. Live-measured on AWS. * docs(plan): record worker-hibernation acceptance and live proof Phase 1 live-proven: local-container full loop (cold 101s vs warm fork 40s, scrub boundary verified) and AWS cold provisioning with graceful degrade at the coordinator admin gate; named upstream follow-ups. * fix(crabbox): make warm-image lifecycle recovery-safe Delete least-recently-used provider snapshots before image index admission. Recover stale empty capture reservations without breaking single-flight. Persist effective machine classes across restarts and revert heartbeat coupling. Align the hibernation plan with the exact-class warm-image key policy.
What Problem This Solves
Cloud worker placements are all-or-nothing: while a session is placed the leased machine bills continuously, and stopping it destroys everything — the next dispatch pays the full cold path again (allocation, Node/setup, registry fetch of the openclaw package, bundle push, workspace sync; several minutes). Competing hosted products (Hermes Agent's Modal/Daytona backends, Codex cloud's container cache, Claude Code on the web's post-setup snapshot) park a sandbox at near-zero idle cost and resume warm.
docs/plan/cloud-workers.mdhad already named "image snapshot after bootstrap" as the v2 fast-start path.Why This Change Was Made
Maintainer-accepted design (committed here as
docs/plan/worker-hibernation.md): of the three evaluated directions — dormant stop-with-disk leases, checkpoint-based warm start, and serverless backends — checkpoint warm start wins because it maps onto capability Crabbox already ships (checkpoint create/forkwith native provider snapshots), needs zero core, SDK, schema, or protocol changes, and preserves every identity/authority invariant by construction: each dispatch still provisions a fresh lease with fresh enrollment. Phase 1 is plugin-only profile warm images; per-session hibernation (SDK capability + additive table) and dormant leases remain explicitly gated in the plan doc.Mechanics (all in
extensions/crabbox/): on teardown of an enrolled worker whose profile opts in viasettings.warmImage, the provider scrubs the box's~/.openclaw/cloud-workersroot (node identity, device token, bundles, all workspace bytes) and initiates a native checkpoint (--wait=false; EBS snapshots complete after termination). Records live in the plugin KV store keyed by a profile-settings hash; single-flight reservation dedupes concurrent teardowns. The next provision forks the checkpoint into the deterministically derived fixed lease id (new Crabbox contract, see companion PR) and rejoins the normal setup/enrollment flow — setup is contractually idempotent and now hits its guards. Any miss, staleness, verify-failure, older crabbox binary, or fork error falls back to coldwarmupwith one warning; capture failures never fail or block teardown. 14-day unused GC deletes the provider snapshot before its index entry.During development this branch surfaced a latent origin/main
doctor-contract-closure-guardfailure (memory-core's doctor closure statically reaching kysely viadreaming.ts); we healed it locally, and #129963 landed the equivalent upstream fix in parallel, so this branch rebases onto that and carries no memory-core changes.User Impact
Opt-in per profile (
cloudWorkers.profiles.<id>.settings.warmImage: true); nothing changes for existing configs. With it enabled, repeat dispatches on a profile skip machine setup and the openclaw package install, at the cost of one provider-account snapshot per profile (storage-priced). Docs: profile-field row + troubleshooting entry in Cloud workers, including the honest current limits (needs the fixed-ID-fork Crabbox release; coordinator-brokered native capture is admin-token-gated upstream today and degrades to cold with one warning).Evidence
Live proof on an isolated dev gateway (state-dir + own port), dev Crabbox build with the fixed-ID fork contract:
activein 101s; reclaim ran scrub +checkpoint create(docker-commit) inside a 37s teardown, checkpointavailable; warm dispatch →activein 40s (2.5× faster). Fork proven by container image ancestry (worker container ran the exact checkpoint-commit imagecrabbox-checkpoint-openclaw-…), preinstalled CLI reused (OpenClaw 2026.8.1from the image), zero fallback warnings in the gateway log. Second reclaim skipped capture (fresh image exists — single-flight/dedupe), leaving exactly one checkpoint. Scrub boundary verified by inspecting the captured image:~/.openclaw/cloud-workersabsent (no identity/token/workspace bytes).active(221s, 311s) through real EC2 allocation + outbound-node enrollment over a cloudflared public origin; teardown capture correctly degraded to cold-only with one warning at the upstream coordinator admin gate (see follow-ups) and teardown still completed. All leases, checkpoints, and checkpoint images deleted afterwards; zero orphans (crabbox listempty).fix(crabbox): budget warm-image capture…).pnpm test extensions/crabbox— 193 passing (mocked-command-runner coverage of key stability, opt-in gating, scrub content, capture eligibility incl. failed-provision cleanup, exact-fixed-lease forks, cold fallback, pending→available promotion, missing-checkpoint cleanup, 14-day GC, concurrent single-flight).node scripts/check-changed.mjsfully green (including the healed closure guard and all dead-code scans).pnpm buildgreen.extensions/crabbox(new capability, plugin-owned; zero coresrc/changes), tests ≈ +580, docs +48 (including the committed design/plan doc).Companion PR: openclaw/crabbox —
checkpoint fork --lease-idwith checkpoint-identity-bound replay adoption (fail-closed on intent drift, native-only) and--jsononcheckpoint create/fork.Follow-ups (named in the plan doc): upstream owner-scoped native checkpoint capture on coordinator-brokered leases (today admin-token-gated → AWS warm images degrade to cold); upstream fresh-AWS-lease early-reboot window that can kill the first post-warmup run; phase 2 (per-session snapshots) and phase 3 (dormant leases) remain design-gated.