Skip to content

perf(crabbox): skip runtime preparation when a warm fork already holds the runtime - #168974

Merged
steipete merged 1 commit into
mainfrom
steipete/crabbox-warm-fork-skip-runtime-prep
Oct 11, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/crabbox-warm-fork-skip-runtime-prep

Conversation

@steipete

@steipete steipete commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes: cloud sessions started from a warm image re-run a separate runtime-preparation script on every start, even when the image already holds the exact runtime. That costs one full Crabbox run, about 43 s on AWS.

User Impact

User impact: warm cloud-session starts become active about 40 s sooner when the warm image matches the Gateway's current runtime, which is the normal case between Gateway updates. Cold starts, prepared projects, and forks from an image built for an older runtime are unchanged.

Why This Change Was Made

A live trace of a warm AWS start (about 190 s to active) showed two Crabbox runs before the node launched:

  • Runtime preparation took 43 s in total, of which only about 6 s was script work. It verifies the runtime and publishes the worker archive, both of which the image already holds.
  • Enrollment took 32 s, of which only 0.1 s was script work.

Crabbox adds about 20–25 s of fixed overhead to each run.

The image records the runtime identity it was captured for. When that identity deep-equals the current one, the provider now skips the runtime-preparation run. Core treats prepareNodeRuntime as optional, so begin() doesn't depend on it.

Safety comes from paths that already exist:

  • The enrollment script still runs runtime verification and downloads the runtime itself if it's missing.
  • If the published worker archive is missing, the node's bundle installer falls back to the authenticated Gateway download.

Evidence

  • Unit tests: a new case covers a fork with the captured runtime, which skips preparation, and a fork with a different runtime, which still prepares. Both pass.
  • Codex autoreview: clean.
  • Live AWS warm dispatch on this branch (fork of an image captured for the current runtime):
    • Time to active was 88 s, against 187–217 s before. The turn passed.
    • Crabbox recorded checkpoint fork (45 s), then a single enrollment run (31 s); there was no runtime-preparation run.
    • Forks of an image captured for an older runtime still ran preparation and downloaded the new runtime, as intended.

…e runtime

A warm fork whose image was captured for the exact current node runtime already holds the verified runtime and published worker archive. Skip the separate runtime-preparation Crabbox run there; enrollment still verifies the runtime, and the node fetches a missing worker bundle from the Gateway. Live trace: that run cost 43 s (6 s of script work plus Crabbox run overhead) of a ~190 s warm AWS start.
@clawsweeper

clawsweeper Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 11, 2026
@clawsweeper

clawsweeper Bot commented Oct 11, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR skips runtime preparation when a forked checkpoint records the exact runtime requested by the Gateway.

Example: An AWS worker forks a checkpoint with matching node-bootstrap and worker-bundle identities.

  • Before: The provider runs runtime preparation and then enrollment.
  • After: The provider runs enrollment directly; a different runtime identity still triggers preparation.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The patch is focused and appears correct, but supplied evidence does not demonstrate the changed behavior through a shipped entry point.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Performance · Worth it: Yes · Fix scope: Complete
User problem: Warm cloud starts wait for a separate remote preparation command despite already holding the requested runtime.
Reason: The existing feature owner proposes a focused reduction in startup work, with no new option or public contract.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it removes redundant work from warm cloud starts, remains necessary on main, and introduces no concrete defect found in this review.

Priority: P2
Reviewed head: 44e4b7a5e442aa848a2bae98732f5a1eeb8fe5cc

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: After-change warm dispatch through the real Gateway and Crabbox remains unshown, and no base-failing execution of the added regression is supplied.
Agent review details

How this fits together

The Crabbox plugin translates Gateway worker provisioning into checkpoint allocation and remote setup commands, returning an enrolled node device.

flowchart TD
Gateway[Gateway provisioning] --> Provider[Crabbox provider]
Provider --> Catalog[Warm image catalog]
Catalog --> Fork[Checkpoint fork]
Fork --> Identity[Runtime identity comparison]
Identity --> Preparation[Runtime preparation when needed]
Identity --> Enrollment[Node enrollment]
Preparation --> Enrollment
Enrollment --> Node[Active worker node]
Loading

Technical review

Best possible solution:

Retain the matching-runtime shortcut with existing enrollment verification and authenticated artifact recovery.

Do we have a high-confidence way to reproduce the issue?

Current main directly shows matching non-project warm forks entering runtime preparation; the reported AWS timings were not independently reproduced.

Is this the best way to solve the issue?

The shortcut fits the existing provider owner and preserves cold preparation, runtime mismatch handling, fresh enrollment, and bundle recovery.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 43c68c34df71.

Provenance checked

  • Ordinary Crabbox runtime preparation changes intended behavior with a stated reason (a6748f0: Prepare the worker archive alongside node bootstrap installation before ordinary enrollment.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

PR surface

Source +20, Tests +34. Total +54 across 3 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 2 21 1 +20
Tests 1 34 0 +34
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 55 1 +54

Review metrics

Metric Value Why it matters
Production versus test changes Production +21/-1; tests +34/-0 Focused growth reuses recorded identities to avoid a remote preparation run and covers matching and mismatching forks.

Labels

Label changes:

  • add P2: This is a bounded startup-performance improvement for warm cloud workers.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: This is a bounded startup-performance improvement for warm cloud workers.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Supply the pending warm-dispatch trace showing successful enrollment without the preparation run.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only; repair and merge need explicit maintainer commands such as @clawsweeper autofix or @clawsweeper automerge.

Reviewed October 11, 2026, 3:28 AM ET / 07:28 UTC.

@steipete
steipete merged commit 3e65a92 into main Oct 11, 2026
109 of 110 checks passed
@steipete
steipete deleted the steipete/crabbox-warm-fork-skip-runtime-prep branch October 11, 2026 11:50
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 12, 2026
…s the runtime (openclaw#168974)

A warm fork whose image was captured for the exact current node runtime already holds the verified runtime and published worker archive, so the provider now skips the separate runtime-preparation Crabbox run there. Enrollment still verifies the runtime (and downloads it if absent), and the node fetches a missing worker bundle from the Gateway. Forks of images captured for another runtime still prepare.

Live AWS warm dispatch: 88 s to active (was 187-217 s); Crabbox ran checkpoint fork (45 s) plus one enrollment run (31 s).
scribe-dandelion-cult added a commit to karmaterminal/openclaw that referenced this pull request Oct 19, 2026
First-parent upstream 75df19c..5ed6a30 (23 commits, including
openclaw#169005 infrastructure SQLite work and runtime-write offload, openclaw#169062,
openclaw#136677, openclaw#169070, openclaw#168857 plugin-sdk SQLite runtime writes into workers,
openclaw#169038, openclaw#168916, openclaw#169053, openclaw#169052 closed-turn transcript work in
workers, openclaw#168974, openclaw#168811, openclaw#169082, openclaw#169084, openclaw#166581 worker heap limits).

Conflicts:
- openclaw-state-worker-runtime.ts: upstream routes more update-run
  mutations to the worker; our continuation custody dispatch stays ahead
  of that branch.
- worker-access inventory: regenerated (632 files, 2429 calls).

server-restart-sentinel.ts auto-merged: upstream's awaited update-run
writes; our continuation restart delivery is unaffected.

Refs #1475

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: crabbox P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant