Skip to content

perf: prepare cloud project runtimes faster - #148952

Merged
steipete merged 1 commit into
mainfrom
codex/cloud-node-bootstrap-perf
Sep 15, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/cloud-node-bootstrap-perf

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Preparing a cloud project image waits for the worker archive to download before npm can install the already-verified node runtime.

User Impact

Fresh project images can become ready sooner. On a two-vCPU AWS Linux machine, three alternating before/after pairs reduced median runtime preparation from 44.9 s to 38.4 s (14%). This measures project runtime preparation, before image capture and node enrollment; it is not a complete session-to-VNC speedup. Cached runtime reuse and ordinary enrollment behavior remain unchanged.

Why This Change Was Made

Start npm while the optional worker archive downloads, after verifying the node archive. Join both operations before publishing the runtime or removing staging files, including when either fails. Keep npm dependency selection, lifecycle policy, credential stripping, and timeout limits unchanged. The combined phase marker records overlapping work without attributing all of it to npm or transport.

Evidence

The real generated runtime-preparation command installed the same 26.5 MB node archive and retained the same verified 12.3 MB worker archive in six fresh Linux homes/caches (Node 24.18.1, npm 11.16.0, two-vCPU AMD EPYC). All six runs verified the CLI, completed lifecycle scripts, created no enrollment identity, and installed identical dependency trees.

Pair Before After Measured download/npm overlap
1 51.2 s 39.1 s 6.1 s
2 44.0 s 38.4 s 14.8 s
3 44.9 s 35.5 s 4.6 s

Network and registry variability affect total times, particularly the first npm install; the complete median difference is not an isolated estimate of the scheduling change. No artificial transfer delay or cache-preference flags were used.

  • The held-download regression fails on the serial original; the candidate completes real npm postinstall while download remains held.
  • Both failure directions preserve staging until the other operation settles. An intentionally unsafe early-rejection mutation fails the npm-error cleanup case.
  • 460 focused tests passed across bootstrap, Windows command generation, replay, project preparation, provider cancellation, and Gateway enrollment.
  • Changed checks and full build passed; independent review found no actionable P0–P2 findings. Exact-head CI must pass before landing.
  • The test lease, artifact server, and temporary ingress were released.

@clawsweeper

clawsweeper Bot commented Sep 15, 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.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime extensions: crabbox size: M maintainer Maintainer-authored PR labels Sep 15, 2026
@steipete
steipete marked this pull request as ready for review September 15, 2026 09:12
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 15, 2026
@clawsweeper

clawsweeper Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 15, 2026, 5:18 AM ET / 09:18 UTC.

ClawSweeper review

What this changes

The PR overlaps cloud worker archive downloads with runtime installation, preserves cleanup ordering, and adds regression coverage and timing documentation.

Merge readiness

✅ Ready for maintainer review

Keep open: this remains a useful, bounded performance improvement absent from current main and the latest release. No actionable correctness or security defect was found.

Priority: P2
Reviewed head: af9c7eb082c7bac5b56d2f80ffc28027c041f977

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused implementation with relevant real measurements and meaningful cleanup regressions; no blocking defect was found.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The supplied PR body records the generated runtime-preparation command running before and after on AWS Linux, with measured overlap, faster median completion, identical installed dependencies, and no enrollment identity; boundary regressions supplement those observations.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The supplied PR body records the generated runtime-preparation command running before and after on AWS Linux, with measured overlap, faster median completion, identical installed dependencies, and no enrollment identity; boundary regressions supplement those observations.
Evidence reviewed 9 items Introduced scope and merge identity: The host-pinned introduction contains only the installer, its tests, and installation documentation. Raw test-merge parents match the pinned base followed by the PR head; its comparison against that base contains the same three paths.
Settlement and publication invariant: The runtime archive is verified before npm starts. Promise.allSettled joins installation and worker download before error propagation, runtime verification, publication, or staging removal. Existing runtime reuse bypasses installation.
Meaningful regression coverage: The generated command runs real npm against an HTTP fixture. Coverage observes postinstall completion while download is held, prevents premature publication, exercises both failure orders, and subsequently checks warm reuse and enrollment. Tests were inspected, not executed during this read-only review.
Findings None None.
Security None None.

How this fits together

The Crabbox plugin prepares OpenClaw runtimes on cloud machines before project image capture and node enrollment. It receives authenticated runtime archives and publishes verified installations for subsequent reuse.

flowchart TD
  A[Gateway runtime archives] --> B[Verify runtime archive]
  B --> C[Install runtime with npm]
  B --> D[Download and verify worker archive]
  C --> E[Wait for both operations]
  D --> E
  E --> F[Verify and publish runtime]
  E --> G[Clean staging after settlement]
  F --> H[Project image capture and enrollment]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +13, Tests +132, Docs +2. Total +147 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 31 18 +13
Tests 1 150 18 +132
Docs 1 2 0 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 183 36 +147

Review metrics

Metric Value Why it matters
Reported preparation latency 44.9 s → 38.4 s median across 3 paired comparisons Real Linux measurements support a preparation benefit, while network variability prevents attributing the entire 14% reduction solely to scheduling.

Technical review

Best possible solution:

Keep preparation in the existing installer, overlap independent work, and publish only after both operations finish successfully.

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

Not applicable as a bug reproduction: this optimizes existing behavior. Current source confirms serial preparation, and the supplied real Linux comparisons measure the proposed improvement.

Is this the best way to solve the issue?

Yes. Scheduling the independent operations within the existing installer avoids a competing implementation while preserving verification, cache identity, and cleanup ordering.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: This is a measured, bounded improvement to cloud project preparation latency.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The supplied PR body records the generated runtime-preparation command running before and after on AWS Linux, with measured overlap, faster median completion, identical installed dependencies, and no enrollment identity; boundary regressions supplement those observations.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The supplied PR body records the generated runtime-preparation command running before and after on AWS Linux, with measured overlap, faster median completion, identical installed dependencies, and no enrollment identity; boundary regressions supplement those observations.

Label justifications:

  • P2: This is a measured, bounded improvement to cloud project preparation latency.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The supplied PR body records the generated runtime-preparation command running before and after on AWS Linux, with measured overlap, faster median completion, identical installed dependencies, and no enrollment identity; boundary regressions supplement those observations.
  • proof: sufficient: Contributor real behavior proof is sufficient. The supplied PR body records the generated runtime-preparation command running before and after on AWS Linux, with measured overlap, faster median completion, identical installed dependencies, and no enrollment identity; boundary regressions supplement those observations.

Evidence

What I checked:

  • Introduced scope and merge identity: The host-pinned introduction contains only the installer, its tests, and installation documentation. Raw test-merge parents match the pinned base followed by the PR head; its comparison against that base contains the same three paths. (909da87f0872)
  • Settlement and publication invariant: The runtime archive is verified before npm starts. Promise.allSettled joins installation and worker download before error propagation, runtime verification, publication, or staging removal. Existing runtime reuse bypasses installation. (extensions/crabbox/src/crabbox-worker-node-enrollment.ts:302, af9c7eb082c7)
  • Meaningful regression coverage: The generated command runs real npm against an HTTP fixture. Coverage observes postinstall completion while download is held, prevents premature publication, exercises both failure orders, and subsequently checks warm reuse and enrollment. Tests were inspected, not executed during this read-only review. (extensions/crabbox/src/crabbox-worker-node-enrollment.test.ts:557, af9c7eb082c7)
  • Real preparation measurements: The complete supplied PR body reports three alternating before/after pairs using the generated preparation command on a two-vCPU AWS Linux machine: median 44.9 s versus 38.4 s, with observed download/npm overlap in all candidate runs. Identical archives and dependency trees, completed lifecycle scripts, and absence of enrollment identity tie these observations to the changed owner. The body explicitly limits the measurement to runtime preparation and acknowledges registry variability. (af9c7eb082c7)
  • Current main still installs serially: Fetched main awaits the worker archive download before invoking synchronous npm installation; it does not contain this scheduling improvement. (extensions/crabbox/src/crabbox-worker-node-enrollment.ts:305, a10df27f8d55)
  • Latest release comparison: The v2026.9.4 source also downloads the worker archive before synchronous npm installation. The released source was retrieved through the GitHub contents API after its local blob was unavailable. (extensions/crabbox/src/crabbox-worker-node-enrollment.ts:292, 3a9d69db306c)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete
steipete merged commit 00a4555 into main Sep 15, 2026
213 of 221 checks passed
@steipete
steipete deleted the codex/cloud-node-bootstrap-perf branch September 15, 2026 10:02
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 15, 2026
* commit '1226eecf4ff909de172a6837422cfa64723fade8': (39 commits)
  test: align model auth and setup fixtures with current behavior (#149023)
  refactor: reuse web search request context (#148949)
  fix(ci): remove duplicate Copilot auth metadata (#149016)
  test(agents): align auth fixtures with runtime store reads (#149004)
  improve: reduce data fetched during reminder maintenance (#148996)
  fix(cron): skip availability checks when session pruning is idle (#148920)
  fix(auth): guard GitHub Copilot device flow authority (#148999)
  fix(agents): prevent early recovery aborts of foreground exec (#148959)
  fix(github-copilot): remove retired Raptor mini (#116505)
  improve(feishu): reduce preparation work for documents with tables (#148997)
  improve: reduce database work when recording participants (#148841)
  test: accept Bun error labels in plugin assertions (#148955)
  fix(models): clarify saved account health and catalog status (#148987)
  test(plugins): align Copilot auth-choice registry expectations (#148981)
  fix(channels): reject blank integer channel add options (#145534)
  fix(ui): preserve archive undo after chat navigation (#148831)
  feat: show cited source previews in macOS and iOS chat (#148906)
  fix: avoid redundant tab updates while chats stream (#148865)
  test(qa): run Discord through Crabline (#116446)
  perf(crabbox): prepare project runtimes during worker download (#148952)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation extensions: crabbox gateway Gateway runtime maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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