Repository navigation
feat(cloud-workers): warm project seeds and automatic image refresh - #131744
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 28, 2026, 7:15 AM ET / 11:15 UTC. ClawSweeper reviewWhat this changesThe branch adds per-repository Git seed reuse for node-worker workspace sync, refreshes stale Crabbox warm images, and scrubs SSH workspaces before image capture. Merge readinessKeep open. This maintainer-authored PR adds a coherent, tested cloud-worker performance and isolation feature; no introduced correctness defect was established. Its machine0 behavior relies on the external Crabbox CLI contract, which could not be independently inspected from the unavailable sibling checkout, so that contract should be confirmed before landing. Priority: P2 Review scores
Verification
How this fits togetherCloud-worker sessions provision a remote machine, enroll it with the Gateway, then synchronize a project workspace. This change lets eligible clean Git repositories reuse a machine-local seed while the Crabbox provider refreshes reusable worker images and removes session-owned files before capture. flowchart LR
A[Clean local repository] --> B[Gateway workspace sync]
B --> C[Node worker seed cache]
C --> D[Fetch delta and checkout]
D --> E[Remote worker workspace]
E --> F[Crabbox worker teardown]
F --> G[Scrub session workspaces]
G --> H[Refresh reusable image]
Decision needed
Why: The changed behavior depends on Crabbox CLI semantics not available in the required sibling checkout, so source review alone cannot confirm the external command contract. Before merge
Agent review detailsSecurityNone. PR surfaceSource +336, Tests +622, Docs +20. Total +978 across 14 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the single validated seed path and the plugin-owned image lifecycle, with a redacted Crabbox contract trace or upstream-source confirmation for the machine0 command before merge. Do we have a high-confidence way to reproduce the issue? Not applicable as an issue reproduction: this PR adds a new acceleration path, and its body reports a real cold-versus-warm worker run plus focused regression coverage. Is this the best way to solve the issue? Yes, subject to external-contract confirmation: seed state is owned by node workspace sync and provider image behavior remains in the Crabbox plugin, avoiding a competing core policy path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 640d73e3d452. 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
|
machine0 Crabbox contract evidence (ClawSweeper decision item)Upstream source (openclaw/crabbox @
Redacted live CLI trace (crabbox built from that exact main SHA; all resources destroyed afterwards): On the teardown-latency note: the capture wait happens inside the reclaim path after the session has already left the machine, capture failure never blocks teardown (warn + cold-only), and the 10-minute budget applies only to |
|
Merged via squash.
|
…penclaw#131744) * feat(cloud-workers): warm project seeds and automatic image refresh * fix(cloud-workers): keep seed freshness on the store clock and cover slow captures
What Problem This Solves
Creating a cloud session on a project you have used before still pays the full cold
path every time: a fresh machine, profile setup, node enrollment, a bundle push, and
a complete repository checkout. On team.openclaw.ai a new session on
openclaw/openclaw sits in "Provisioning environment…" for minutes. Warm machine
images (phase 1 of docs/plan/worker-hibernation.md) exist but silently degrade to
cold on the machine0 provider (its native checkpoints require
--strategy image),are captured once and never refreshed, and deliberately exclude the workspace — so
even a warm fork re-clones the whole repository from GitHub per session.
Why This Change Was Made
Three coordinated repairs, each at its owning boundary:
published-origin sync — while the workspace is a pristine clone, before any agent
activity — the worker stores a copy at
~/.openclaw-worker/git-seeds/<gatewayNamespace>/<sha256(origin)>, the samemachine-level cache boundary as content-addressed bundle installs (outside the
per-lease scrub root). The next session for the same repository applies the seed
and runs
git fetch(delta) +git checkoutinstead of a full blobless clone.Seed operations are first-class protocol ops (
seed: {action, key}) — theworkspace exec transport's argv path-containment guard stays intact and no host
paths cross the wire. Old node hosts reject the unknown field with
INVALID_REQUEST; the gateway memoizes that per placement and degrades totoday's clone path. Seed mtime is deliberately the store-freshness clock:
apply never bumps it, so an actively used seed still re-stores every 6h and
stale content cannot pin itself "fresh".
checkpoint createpasses--strategy imageon machine0 with a 10-minute capture budget (machine0 imagesave stops the source and waits for availability even with
--wait=false,verified against crabbox main); images older than 24h are re-captured at the
next eligible teardown and the superseded checkpoint is deleted best-effort;
the reservation-staleness window now covers the slowest provider capture budget
so a live capture cannot be stolen and orphan a checkpoint; the existing
14-day unused GC and 128-entry cap stay.
~/.openclaw-worker/workspaces— SSH-transport (remote-exec) sessionworkspaces previously survived into shared provider images.
Seeds contain only origin-published repository content (taken from a fresh clone
before the turn starts, never at teardown), so no session work, agent state, or
credentials can enter a shared image through this path.
settings.warmImageremains opt-in per the accepted phase-1 review.
User Impact
A new cloud session on an already-used project skips machine boot + toolchain
install (warm image fork) and transfers only the repository delta since the image
was captured, instead of a full clone. Automatic refresh keeps the captured seed,
npm cache, and toolchain current without operator action; superseded and unused
checkpoints are cleaned up automatically. machine0 — the team.openclaw.ai
provider — now actually captures and forks warm images instead of silently cold
provisioning.
Evidence
Live A/B, isolated qa gateway child + real crabbox (built from crabbox main
58323474, which carries the fixed-ID fork + JSON contract) + Docker
local-container backend + real GitHub repo (openclaw/crabbox) + mock model:
activepublished-origin, full blobless clone)published-origin-seeded, copy + delta fetch + checkout)docker-commitcaptureworker workspace sync path selectedwithreason: "published-origin"(cold) andreason: "published-origin-seeded"(warm); no seed-store or seeded-sync failure warnings.
chk_3c084f4a99a075d4(kinddocker-commit) createdduring the cold teardown,
lastUsedAtbumped at the warm fork.checkpoint create --mode native --wait=false --json→ fixed-IDcheckpoint fork --lease-id … --jsonreturns the exact{checkpointId, leaseId, provider, slug, workdir}identity the plugin validates, and content under
~/.openclaw-worker/git-seeds/survives capture → fork.
command sequence with crabbox built from main:
checkpoint create --strategy image --wait=false --jsoncaptured amachine0-imagein 254s — validatingthe new 10-minute machine0 budget (the previous 180s cap would have starved
every capture); fixed-ID
checkpoint fork --lease-idbooted a ready VM in132s;
~/.openclaw-worker/git-seedscontent survived capture -> fork; andpre-seeded
~/.openclaw-worker/workspacescontent also survived, demonstratingthe exact leak the scrub extension closes. Both proof VMs, the checkpoint, and
the machine0 image were deleted afterwards. Honest bound: on machine0 the
~2-minute VM create/boot dominates machine acquisition in both modes; warm
forks remove the setup, enrollment-install, and repository-clone legs that
follow it (the standby-lease follow-up targets the boot floor itself).
node scripts/run-vitest.mjs src/worker/node-workspace-protocol.test.ts src/node-host/node-worker-workspace.test.ts src/gateway/worker-environments/node-worker-workspace-fallback.test.ts extensions/crabbox/src/crabbox-worker-warm-image.test.ts— all green (76+tests, incl. seed round-trip on a real git repo, containment/symlink rejection,
prune, freshness, fallback ordering, INVALID_REQUEST memoization, refresh races,
restore-on-failed-refresh, machine0 strategy args).
node scripts/check-changed.mjsgreen;pnpm buildgreen (noINEFFECTIVE_DYNAMIC_IMPORT).(~9s cold clone); openclaw-sized repositories pay tens of seconds to minutes on
the clone leg that the seed removes.
Production LOC: +~330 (new capability: seed store + protocol op + plugin
auto-refresh); tests +~620.
Follow-ups (named, not in this PR): seeding for the SSH/rsync sync path
(remote-exec parity); relocating the node-path bundle cache outside the per-lease
state dir so warm forks also skip the bundle push + prewarm; standby forked leases
(machine0 supports pause/resume) for single-digit-seconds session starts;
per-phase provisioning timing telemetry.