Skip to content

Commit a82042f

Browse files
authored
feat(crabbox): opt-in profile warm images for cloud workers (#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.
1 parent b922773 commit a82042f

6 files changed

Lines changed: 1360 additions & 33 deletions

File tree

‎docs/gateway/cloud-workers.md‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,12 @@ Add a profile under `cloudWorkers.profiles` in `openclaw.json`:
108108

109109
Profile fields:
110110

111-
| Key | Meaning |
112-
| ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
113-
| `provider` | Worker provider id registered by a plugin (`crabbox` for the bundled plugin). |
114-
| `install` | Installation preference for SSH-backed providers. The bundled Crabbox provider always installs the current Gateway bundle through the authenticated node channel. |
115-
| `settings` | Provider-owned JSON. For crabbox: `provider` (backend), `class` (machine class), `ttl`, `idleTimeout` (Go durations), optional idempotent `setup`, optional `desktop`, and absolute `binary` path. While a session remains placed, OpenClaw heartbeats its lease at a safe fraction of `idleTimeout`; teardown stops the heartbeat before releasing the machine. `desktop: true` asks Crabbox to warm the lease with its browser and loopback RFB desktop before node enrollment. |
111+
| Key | Meaning |
112+
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
113+
| `provider` | Worker provider id registered by a plugin (`crabbox` for the bundled plugin). |
114+
| `install` | Installation preference for SSH-backed providers. The bundled Crabbox provider always installs the current Gateway bundle through the authenticated node channel. |
115+
| `settings` | Provider-owned JSON. For crabbox: `provider` (backend), `class` (machine class), `ttl`, `idleTimeout` (Go durations), optional idempotent `setup`, optional `desktop`, and absolute `binary` path. While a session remains placed, OpenClaw heartbeats its lease at a safe fraction of `idleTimeout`; teardown stops the heartbeat before releasing the machine. `desktop: true` asks Crabbox to warm the lease with its browser and loopback RFB desktop before node enrollment. |
116+
| `settings.warmImage` | Optional, disabled by default. Set to `true` to save a reusable machine image when an enrolled worker stops and start later workers with the same profile from that image. Images incur snapshot storage charges in your cloud provider account. OpenClaw removes worker identities, device tokens, bundles, and all workspace files before creating an image; enable reuse only for mutually trusted workloads. Image capture needs a Crabbox release with fixed-ID checkpoint forks, and coordinator-brokered leases additionally need `broker.adminToken` for native image capture; without either, every stop degrades to normal cold provisioning with one warning. |
116117

117118
### Per-project default profiles
118119

@@ -371,6 +372,7 @@ The desktop never gains public ingress. The node reads `/var/lib/crabbox/vnc.pas
371372
- **AWS instance-role attestation fails** — clear `aws.instanceProfile` (and `CRABBOX_AWS_INSTANCE_PROFILE`, if set). Install Crabbox 0.41.1 or newer; older binaries do not satisfy the fixed-ID and authoritative `providerMetadata.instanceProfileAttached` contracts required for AWS admission.
372373
- **Dispatch or workspace recovery fails** — inspect `environments.list` and `sessions.describe`. A failed environment exposes its bounded environment error. A failed placement exposes `recoveryError` plus its durable per-session `terminalReason`; the selected Control UI chat shows that terminal reason above the composer. When deeper diagnosis is necessary, an operator on the Gateway host can inspect the durable worker state read-only. Do not edit the state database to bypass lifecycle fencing.
373374
- **Crabbox setup cannot reach the lease** — compare the Gateway host's current outbound IPv4 with an explicitly configured `aws.sshCIDRs` policy in `crabbox config show --json`. If the matching `/32` is absent, correct Crabbox's configuration and rerun `crabbox doctor --provider aws --json` before retrying. An empty configured list is valid when Crabbox discovers and injects the caller's `/32` for the request.
375+
- **A warm image was stale or missing** — dispatch falls back to normal cold provisioning automatically. This is expected behavior and does not require a retry.
374376
- **Node enrollment times out** — inspect the package selection, node process state, and bounded node-log tail included in the enrollment error. Verify that profile setup installed Node.js and `npx` and that the box can reach the Gateway's advertised TLS URL and public worker/node WebSocket route. If the error contains `proxy_attribution_required`, add the reverse proxy's source address to `gateway.trustedProxies`.
375377
- **Client timeout while dispatching** — `openclaw gateway call` defaults to a 10s timeout; pass `--timeout` generously. Dispatch keeps running server-side either way, and an identical retry on the same Gateway joins that in-flight operation instead of provisioning another worker. A retry with a different profile or session identity is rejected.
376378
- **Direct AWS authorization fails after `doctor` passes** — `doctor` proves read-only AWS access, not the complete mutation policy. Inspect the named denied action and grant only Crabbox's required provisioning/cleanup actions, or configure coordinator-backed Crabbox instead. A fresh direct AWS lease normally needs key-pair import before `RunInstances`; an authorization failure there creates no instance.

0 commit comments

Comments
 (0)