Skip to content

perf(workers): streamline cloud startup and fix bootstrap archive races - #134043

Merged
steipete merged 4 commits into
mainfrom
codex/project-warm-start
Aug 31, 2026
Merged

steipete merged 4 commits into
mainfrom
codex/project-warm-start

Conversation

@steipete

@steipete steipete commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Cloud startup repeats provider inspections after trusted setup and successful snapshot forks. Daytona also rejects capture of a running source without explicit permission to stop it. A real Gateway experiment exposed another startup failure: Node's process-wide umask getter can race concurrent archive writes, making recorded permissions disagree with the staged files and preventing allocation.

What Changed

Trusted runtime and enrollment scripts use the existing command-completion and failure-cleanup owner. Arbitrary profile/desktop setup still refreshes readiness and security information, and native capture still refreshes the restored source. A successful fork carries its exact checkpoint identity forward; a replaced image still requires verification. Daytona receives its required --no-reboot=false flag.

The archive producer records the permissions actually applied by the filesystem, retaining the verified input digest and full final archive comparison. Windows normalization is unchanged. A shared test fixture now supplies its prepared model capabilities, removing unintended catalog discovery without changing production behavior or test deadlines.

No configuration, schema, retention policy, timeout, setup semantics or enrollment authority changes. This does not introduce prepared running capacity or make new sessions start in seconds.

Validation

  • 372/372 Linux tests across eight suites, plus six plugin-entrypoint cases, cover setup, enrollment, capture, warm reuse, replay, concurrency and cleanup. Linux run.
  • The three installation variants fail against the unsafe getter. All 18 bootstrap/archive tests pass normally, under umask 077, and after integration. The media fixture passes 24 tests; its slow case falls from over 100 seconds of unintended discovery to 603 ms. Changed static gates pass.
  • All 15 public build phases pass at 024f984209ce95d3ba5c6608bac78c51c83e7938. The current head f47921a367b1a002184170c745a77237ec716a09 replays the same substantive changes onto ace8a13, retaining newer main lifecycle/store fixes. Every added/deleted line remains identical, and the root changelog matches main. The earlier build/live results prove preserved PR behavior; they are not an exact rebased-artifact claim. The generated payload and seven native targets were independently verified; the actual compiled bootstrap producer passes under umask 077 with 10,362 archive entries. Public package assets and local Gateway command execution also pass.
  • Fresh review of the complete rebased 11-file candidate through P2 found no actionable findings; all four replay commits passed normal hooks and the final tree matches the reviewed candidate. Earlier required CI passed. The later05eb run failed upstream Promise-executor lint and authored-config/WebSocket types. Main fixed those in PR134207, now included in this base. Exact-head CI is now green. Its first attempt hit a 256 MiB V8 heap failure in the unrelated deep doctor-import fixture. One unchanged rerun used the original merge, Node 24.19.0 and heap limit; batch, deep and public cases passed in 39.856s, 48.019s and 64.297s. The original failure remains unexplained and is retained as a named heap-variability follow-up, not a claimed repair.

The real Machine0 Gateway flow passed cold, warm and already-active worker turns. The warm session forked the same snapshot while the cold session remained connected. Both fresh identities, pristine Git commit/tree, dirty/untracked overlay isolation and retained runtime digest were verified. Warm performed no project upload/install, runtime installation/download, new capture, origin request or full-pack request.

Single-run timing Cold Warm Already active
Dispatch to active placement 1,163.586s 303.132s —
Session creation to first command 1,172.789s 314.123s —
Turn to first command 8.916s 10.466s 7.837s

This used a mock model and a three-file synthetic project. The cold runtime transfer alone took 431.616s, so the difference is not a pure snapshot-speed measurement. The warm worker bundle still transferred separately in 42.004s. Setup ran per provision; the retained build marker is a machine cache outside the project, not proof of arbitrary project builds. Permissions stayed unset. Node plugin plan was empty: Codex remote-exec and plugin-enablement latency are not measured.

Both VMs and the image were deleted through canonical owners and independently absent under the unchanged account. The controller returned 1 on a final process-probe EPERM after child closure; a separate exact PID/process-group read proved absence. That failure and reconciliation remain recorded. All helper processes stopped and task access files were removed.

Daytona Contract and Remaining Scope

Direct source inspection and real native Daytona capture/restore/fork proof cover the changed flag contract: Crabbox declares and forwards the flag, and the Daytona owner stops, captures, waits for settlement and restores readiness. Its native capture barrier does not depend on --wait. The real capture completed in 13.412s; two fresh forks completed in 7.717s and 7.193s with Git/build markers preserved and session overlays isolated. Cleanup verified all native resources absent. Relevant source blobs match the tested Crabbox binary; this is not an official release claim.

The latest ClawSweeper review of f47921a3 asked whether the new flag requires a higher released Crabbox minimum. It does not: published Crabbox 0.41.1, the documented baseline, already declares and forwards no-reboot. The checksum-verified released macOS ARM64 binary accepts checkpoint create --provider daytona --no-reboot=false --help with exit 0; invalid-boolean and unknown-flag controls exit 2. These parser runs used empty isolated configuration with network access denied. This proves compatibility of the added flag, not full Daytona native/fixed-ID/JSON support in 0.41.1. Warm images retain their separately documented fixed-ID checkpoint capability requirement; no Doctor minimum change is justified by this flag. The native lifecycle proof above remains pinned to the tested newer Crabbox candidate.

The lead directly inspected both released CLI source and the tested Daytona lifecycle. The net 24 production lines remain the canonical command-completion split, fork-fact propagation and applied-mode record. The automated stored-data classification does not correspond to a schema or serialized-shape change: the archive manifest already had a mode field, whose value now records the actual file.

Full Daytona Gateway proof remains unavailable because live credentials are unavailable; native Daytona API proof and the full Machine0 Gateway flow remain explicitly separate. Full Daytona Gateway, Windows runtime and seconds-level prepared-session adoption remain unproven.

Production is +41/-17 (net +24), tests/support +148/-72, docs +2. Growth supplies the shared command-completion owner, carries the existing fork result and records applied file modes. Named follow-ups: investigate the unchanged deep doctor-import fixture’s 256 MiB heap variability; remove the same unsafe umask getter from fs-safe atomic text writes without implicitly changing directory permissions, which needs a separate dependency repair.

@clawsweeper

clawsweeper Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime extensions: crabbox size: M maintainer Maintainer-authored PR labels Aug 31, 2026
@steipete
steipete marked this pull request as ready for review August 31, 2026 10:25
@clawsweeper clawsweeper Bot added merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 31, 2026
@clawsweeper

clawsweeper Bot commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 31, 2026, 1:46 PM ET / 17:46 UTC.

ClawSweeper review

What this changes

The branch removes redundant cloud-worker readiness probes after trusted setup and successful image forks, enables Daytona snapshot capture to stop its source, and records the filesystem-applied modes in bootstrap archives.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep open for explicit maintainer review: this member-authored, maintainer-labeled PR has no confirmed introduced source defect, but its Daytona behavior depends on an external Crabbox CLI contract that could not be directly inspected in this offline review.

Priority: P2
Reviewed head: f47921a367b1a002184170c745a77237ec716a09
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch is a coherent owner-boundary repair with focused coverage; only the externally unavailable Daytona contract remains for maintainer confirmation.
Proof confidence 🌊 off-meta tidepool Not applicable: This member-authored PR is exempt from the external-contributor proof gate. Its body reports Machine0 Gateway and native Daytona evidence, but this offline review could not independently inspect those external artifacts or the Crabbox dependency.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This member-authored PR is exempt from the external-contributor proof gate. Its body reports Machine0 Gateway and native Daytona evidence, but this offline review could not independently inspect those external artifacts or the Crabbox dependency.
Evidence reviewed 6 items Introduced provisioning split: The new completion-only setup helper retains failure cleanup, while profile and desktop setup continue using the readiness-refreshing helper; runtime preparation and enrollment use the narrower helper.
Warm-fork invariant: Allocation validates the forked checkpoint, lease ID, provider, slug, and work directory before returning its checkpoint choice; capture skips a second verification only for that same successful fork.
Bootstrap archive repair: The introduced write path records the staged file mode with fs.stat after writing, while the existing post-archive manifest comparison remains in place.
Findings None None.
Security None None.

How this fits together

Crabbox is the bundled cloud-worker provider used by the Gateway to allocate a machine, prepare project and runtime state, capture reusable images, and enroll a node. The bootstrap artifact builder packages the Gateway runtime that is transferred to that node.

flowchart LR
  A[Gateway worker request] --> B[Crabbox allocation]
  B --> C[Project and runtime preparation]
  C --> D[Snapshot capture or warm fork]
  D --> E[Node enrollment]
  E --> F[Bootstrap artifact transfer]
  F --> G[Active cloud worker]
Loading

Decision needed

Question Recommendation
Can a maintainer independently confirm that the released Crabbox 0.41.1 baseline accepts --no-reboot=false for Daytona capture and preserves the required stop/capture/restore lifecycle? Verify the released Crabbox contract: Confirm the 0.41.1 parser and Daytona lifecycle before merge, preserving the documented baseline when they match the PR evidence.

Why: The introduced command directly depends on that external CLI contract, but network resolution prevented direct upstream-source or released-binary inspection in this review.

Before merge

  • Resolve merge risk (P1) - Daytona warm-image capture now intentionally permits Crabbox to stop and restore an existing source. The local review could not independently verify that the documented 0.41.1 floor accepts the flag and provides the asserted restore barrier, so an unsupported or divergent CLI could leave an operator without warm-image capture.
Agent review details

Security

None.

PR surface

Source +31, Tests +69, Docs +2. Total +102 across 11 files.

View PR surface stats
Area Files Added Removed Net
Source 5 48 17 +31
Tests 5 141 72 +69
Docs 1 2 0 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 11 191 89 +102

Review metrics

Metric Value Why it matters
Production versus test delta production +41/-17 (net +24); tests/support +148/-72; docs +2 The production growth is concentrated in the setup-completion split, warm-fork fact propagation, and filesystem-applied archive-mode record.

Stored data model

Persistent data-model change detected: durable storage schema: src/gateway/worker-environments/node-bootstrap-artifact.ts, serialized state: src/gateway/worker-environments/node-bootstrap-artifact.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Verify the released Daytona contract before merge (recommended)
    Check the documented Crabbox 0.41.1 baseline accepts the new flag and restores a stopped source after native snapshot capture.
  2. Accept the dependency evidence as recorded
    Proceed while explicitly accepting the remaining external-contract uncertainty for Daytona warm-image users.

Technical review

Best possible solution:

Before merge, independently verify the documented Crabbox 0.41.1 command contract and Daytona stop/capture/restore behavior, then retain this owner-boundary split and archive-mode repair.

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

No high-confidence independent reproduction was available: the prior behavior is clear in current-main source, but this read-only review could not execute the provider path or inspect the external Crabbox implementation.

Is this the best way to solve the issue?

Unclear pending external-contract verification. The code keeps readiness refreshes where setup can alter SSH state and narrows only the internally owned paths, which is the right shape if the Daytona lifecycle claim holds.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against b75d04d01617.

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P2: This is a bounded cloud-worker reliability and startup improvement rather than an emergency core-runtime failure.
  • merge-risk: 🚨 compatibility: The new Daytona CLI argument changes behavior for existing warm-image installations at the documented external CLI baseline.
  • merge-risk: 🚨 availability: If the external Daytona stop-and-restore contract diverges from the asserted behavior, warm-image capture can fail during worker provisioning.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This member-authored PR is exempt from the external-contributor proof gate. Its body reports Machine0 Gateway and native Daytona evidence, but this offline review could not independently inspect those external artifacts or the Crabbox dependency.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

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

  • Independently verify the released Crabbox 0.41.1 Daytona flag and restoration contract before merge.

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.

History

Review history (5 earlier review cycles)
  • reviewed 2026-08-31T10:32:29.982Z sha 75ced5f :: needs maintainer review before merge. :: none
  • reviewed 2026-08-31T10:57:22.419Z sha b0d486c :: needs maintainer review before merge. :: none
  • reviewed 2026-08-31T15:13:48.598Z sha 05eb09a :: needs maintainer review before merge. :: none
  • reviewed 2026-08-31T16:21:43.144Z sha f47921a :: needs maintainer review before merge. :: none
  • reviewed 2026-08-31T16:31:12.254Z sha f47921a :: needs maintainer review before merge. :: none

@steipete steipete changed the title perf(crabbox): streamline warm project activation perf(workers): streamline cloud startup and fix bootstrap archive races Aug 31, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Head 6a7372898c107265bdff429bba7dfe1f15ec8c57 adds the bootstrap archive permission repair after the previous review at b0d486ca4292: record actual staged file modes without invoking Node's process-wide umask getter. The pre-write content digest and full archive verification remain in place. Three regressions fail on the original producer; all 18 focused cases pass normally and under umask 077. The complete public build and actual compiled producer also pass with 10,362 archive entries. The final head differs from that compiled source only by changelog placement.

The earlier requested Crabbox flag/source contract evidence is posted above. Full Daytona Gateway proof remains unavailable in this run; the already-recorded live Daytona evidence covers native capture, restore and two isolated fixed-ID forks, not Gateway dispatch. A bounded Machine0 Gateway cold/warm experiment is in progress. Its outcome will be reported separately; it is not yet a successful cloud-turn result.

@clawsweeper

clawsweeper Bot commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 31, 2026
Reuse the successful snapshot fork attestation and finish trusted runtime
preparation and enrollment through the shared command cleanup owner.
Keep provider readiness refreshes for arbitrary setup and native capture.
Allow Daytona to perform its required snapshot stop/capture/restore cycle.

Validated with 372 Linux tests, canonical changed-surface checks, and the
full QA-enabled build. The only later test edit removes an unused import.
Remove the obsolete post-enrollment inspect expectation for AWS worker-turn
and Hetzner remote-exec. The explicit lifecycle inspection remains covered.
All six existing plugin-entrypoint cases pass; runtime bytes are unchanged.
@steipete
steipete force-pushed the codex/project-warm-start branch from 05eb09a to f47921a Compare August 31, 2026 16:14
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Aug 31, 2026
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 31, 2026
@steipete
steipete merged commit 5882198 into main Aug 31, 2026
438 of 441 checks passed
@steipete
steipete deleted the codex/project-warm-start branch August 31, 2026 17:48
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 1, 2026
…es (openclaw#134043)

* perf(crabbox): streamline warm project activation

Reuse the successful snapshot fork attestation and finish trusted runtime
preparation and enrollment through the shared command cleanup owner.
Keep provider readiness refreshes for arbitrary setup and native capture.
Allow Daytona to perform its required snapshot stop/capture/restore cycle.

Validated with 372 Linux tests, canonical changed-surface checks, and the
full QA-enabled build. The only later test edit removes an unused import.

* test(crabbox): align classless enrollment inspection expectation

Remove the obsolete post-enrollment inspect expectation for AWS worker-turn
and Hetzner remote-exec. The explicit lifecycle inspection remains covered.
All six existing plugin-entrypoint cases pass; runtime bytes are unchanged.

* test(auto-reply): prepare model capabilities in mock followups

* fix(workers): record actual bootstrap file permissions
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 merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. 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