Skip to content

fix(crabbox): preserve project snapshots across runtime updates - #170780

Merged
steipete merged 1 commit into
mainfrom
snap/key-split
Oct 13, 2026
Merged

steipete merged 1 commit into
mainfrom
snap/key-split

Conversation

@steipete

@steipete steipete commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Problem

What Problem This Solves

Gateway updates, plugin toggles, and lease-policy edits invalidate prepared project snapshots because the disk compatibility key includes runtime artifacts and the full profile. Subsequent cloud sessions start cold even when the repository environment is unchanged.

Solution

Separate disk compatibility from ready-worker identity. Crabbox supplies its existing resolved disk-profile fingerprint through the optional resolvePreparationTarget().profileKey contract, so core does not duplicate provider policy. Other providers retain conservative settings-based compatibility. The disk key includes provider/backend, resolved OS/architecture/class, setup inputs, project identity, repository recipe/skip choice, workspace protocol, and contract version 2. Exact runtime artifacts, profile, and commit remain in the ready-worker key.

Compatible project forks with an older runtime run runtime preparation and enrollment verification. A runtime-only change does not cause foreground pre-enrollment capture. Background reserve/build preparation and age refresh can publish the updated runtime. Existing source-generation replacement fences and interrupted/enrolled replay semantics remain in place. Both capture and top-up use the same runtime-installation implementation.

Profile field decisions

Field Snapshot compatibility decision
Profile provider Keep canonical provider ID; provider-owned backend is also retained.
Profile install Omit: node-backed preparation requests bundled node/worker archives independently of this worker-install setting. Keep in ready-worker identity.
Profile suspendAfter, readyWorkers Omit: lifecycle/capacity policy, not captured disk content.
Profile ID Omit from disk key; retain in ready-worker identity.
settings.provider Keep normalized backend.
settings.class, placement machineClass Keep exact effective class; cross-class reuse remains excluded.
settings.target, placement os, target architecture Keep effective target; ignored requested defaults do not create extra identities.
settings.setup Keep normalized setup text.
settings.setupEnv Keep sorted variable names; never values. Eligibility/secret handling is unchanged in this lane.
settings.desktop Keep effective boolean; omitted and false are equivalent.
settings.binary Omit: local Crabbox executable path.
settings.ttl, settings.idleTimeout, derived heartbeat/timeout values Omit: allocation/renewal policy.
settings.warmImage Omit: controls eligibility, not image bytes.
Execution mode Omit from disk key; retain in runtime and ready-worker identity and top up after a fork.
Node archive, enabled plugins, worker bundle/archive, OpenClaw version, runtime protocol features Omit from disk key; retain recorded runtime/readiness facts.

Impact

Compatible repository snapshots survive routine Gateway/runtime updates and non-provisioning profile changes. Older runtime images are topped up after forking, without an extra foreground snapshot solely for that runtime change. First capture, setup repair, interrupted preparation, and age refresh retain their existing capture boundaries.

Update behavior: previous-contract prepared project images are incompatible with new allocations and retire through normal retention. The outer Crabbox image-record key stays stable so existing allocations retain their replay identity. Existing version-3 plugin-state records are unchanged; historical preparation identities remain readable for their lifecycle. No SQLite/schema migration, config change, or new operator setup is required. No live cloud lease was used; integrated AWS proof remains a follow-up.

Evidence

  • pnpm test src/gateway/worker-environments/preparation-identity.test.ts extensions/crabbox/src/crabbox-worker-prepared-image.test.ts extensions/crabbox/src/crabbox-worker-profile.test.ts --maxWorkers=1 — 32 passed, 261.28 s wall time, including cold worker compilation.
  • pnpm test extensions/crabbox/src/crabbox-worker-warm-image*.test.ts extensions/crabbox/src/crabbox-worker-project.test.ts --maxWorkers=1 — 181 passed across 10 files, 578.59 s wall time. This exercises existing replay, capture custody, runtime preparation, generation replacement, retention, and cleanup contracts.
  • pnpm test extensions/crabbox/src/crabbox-worker-profile.test.ts extensions/crabbox/src/crabbox-worker-prepared-image.test.ts extensions/crabbox/src/crabbox-worker-warm-image-allocation.test.ts --maxWorkers=1 — final replay-key correction: 29 passed, 126.66 s wall time.
  • pnpm test extensions/crabbox/src/crabbox-worker-profile.test.ts extensions/crabbox/src/crabbox-worker-prepared-image.test.ts --maxWorkers=1 — final profile-owner extraction: 14 passed, 65.57 s wall time.
  • pnpm test src/gateway/worker-environments/preparation-identity.test.ts --maxWorkers=1 -t 'invalidates a changed runtime before allocation' — fails on the original implementation at the cache-key equality assertion (22.25 s), passes on the candidate (20.66 s). Candidate source was restored byte-for-byte after the comparison.
  • pnpm build:runtime — final candidate passed, 96.07 s (earlier complete runtime build: 188.27 s). Full pnpm build was stopped after 1067.17 s: package declaration generation had spent over 12 minutes without completing the step. The supported runtime build completed; full declaration-build proof remains with CI.
  • pnpm tsgo — passed, 794.14 s including the wait for build artifact ownership. pnpm tsgo:extensions — final candidate passed, 6.13 s (earlier run: 193.81 s including the runtime-build lock wait).
  • node scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.core.json src/gateway/worker-environments/preparation-identity.test.ts src/gateway/worker-environments/preparation-identity.ts src/plugins/capability-provider.types.ts — passed, 23.70 s.
  • node scripts/run-oxlint.mjs --tsconfig extensions/tsconfig.json extensions/crabbox/src/crabbox-worker-prepared-image.test.ts extensions/crabbox/src/crabbox-worker-profile.test.ts extensions/crabbox/src/crabbox-worker-profile.ts extensions/crabbox/src/crabbox-worker-provider.ts extensions/crabbox/src/crabbox-worker-warm-image-capture.ts — passed, 78.05 s. The initial run reported 711 counted provider lines against the 700-line cap; moving the preparation-target projection into its existing profile owner resolved it.
  • pnpm format:check on all ten changed files passed (0.85 s); git diff --check passed.
  • pnpm check:line-cap-ratchet --base origin/main passed (6.55 s); pnpm check:max-lines-ratchet --base origin/main passed (55.05 s). No baselines, caps, or guards were changed.
  • Independent Codex autoreview is scoped-clean through P2. Its upgrade-replay finding was resolved by retaining the existing outer image key, with a regression pinning its persisted hash.

The initial focused run exposed a deletion-budget fixture that depended on a readiness-key change forcing capture. It now requests setup repair explicitly, preserving the deletion-budget proof under the new capture policy. The provider tests use the existing command/SQLite boundary fixtures; they boot no Gateway and use no live cloud lease. Host contention and cold worker compilation account for much of the wall time. CI test seconds are pending. Rebased onto main after a documentation-only conflict: all eight changed TypeScript files are byte-identical to the reviewed/tested candidate; docs formatting and git diff --check passed again. Main's resolved-directory/normalized-URL wording is preserved.

Release-note context

Cloud sessions reuse compatible repository snapshots across Gateway updates and plugin changes, topping up the worker runtime after fork instead of rebuilding the environment or waiting for a runtime-only snapshot capture.

@clawsweeper

clawsweeper Bot commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-13T07:37:03.950340Z 17d4a27 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime extensions: crabbox size: M labels Oct 13, 2026
Separate disk compatibility from exact runtime readiness. Top up compatible foreground forks without a runtime-only capture, preserving age refresh, generation ownership, and allocation replay. Keep the existing outer image-record key and bump only the preparation contract.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8b78e0edf6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +311 to +312
/** SHA-256 of provider-owned disk/boot settings, excluding runtime and lease policy. */
profileKey?: string;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Specify or normalize the profile fingerprint encoding

The new public contract describes profileKey only as a SHA-256 digest, so an external provider may legitimately return an uppercase hexadecimal or another standard digest encoding. During project preparation, Target.parse() accepts only lowercase 64-character hex via Digest, causing such a provider's dispatch to fail with “Worker project preparation identity is invalid.” Normalize the value or explicitly require lowercase hexadecimal in the SDK contract so runtime enforcement matches the documented plugin API.

AGENTS.md reference: src/plugins/AGENTS.md:L25-L29

Useful? React with 👍 / 👎.

@steipete
steipete merged commit 1c5e7a4 into main Oct 13, 2026
129 of 131 checks passed
@steipete
steipete deleted the snap/key-split branch October 13, 2026 08:59
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Oct 13, 2026
* commit '7ae69497bec4d9c37f170f046a3cbbf954ff19a7': (6238 commits)
  refactor(ui): replace Systems filters with native menu (#170786)
  fix(browser): browser open honors timeoutMs for its opening navigation (#170053)
  refactor: deslop old Apple shared/macOS and Control UI code (#170823)
  perf(memory): reuse pooled origin readers (#170795)
  fix(crabbox): preserve project snapshots across runtime updates (#170780)
  fix: prevent chat image loading from shifting messages (#170819)
  refactor(ui): use native menus for Secret Store actions (#170663)
  fix(gateway): keep chat metadata available during model reloads (#170805)
  fix: preserve diagnostics for unresponsive state lease heartbeats (#170835)
  fix(test): prepare runtime config for corpus revision proof
  test: give credential fixtures database ownership
  perf(auth): unblock session writes during health preparation (#170807)
  fix(ci): use smaller runners for selected Gateway client tests (#170821)
  fix: use same-commit plugins in development macOS builds (#170776)
  perf(github): share cached reads across sessions and searches (#170825)
  fix(projects): keep listings stable during unrelated session changes (#170824)
  fix(update): update repair fails after Doctor completes on busy macOS hosts (#170779)
  fix(heartbeat): suppress truncated NO_REPLY finals such as NO_R (#170190)
  perf(sessions): reduce read transaction overhead (#170745)
  refactor: simplify older plugin and package lifecycles (#170800)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 14, 2026
…claw#170780)

Separate disk compatibility from exact runtime readiness. Top up compatible foreground forks without a runtime-only capture, preserving age refresh, generation ownership, and allocation replay. Keep the existing outer image-record key and bump only the preparation contract.
vincentkoc added a commit that referenced this pull request Oct 18, 2026
* feat(qa): report scorecard evidence gaps

Distinguish catalog coverage, recorded attempts, and qualified evidence without changing scores or release gates.

Include the canonical compatibility migration-status correction from ec1fb60.

Co-authored-by: Patrick Erichsen <[email protected]>

* chore(qa): drop compatibility backport already on main

Keep the QA evidence-gap change scoped to its 13 paths. The canonical compatibility correction ec1fb60 and later refinements are already on main; restore the six branch preimages so the merge consumes that upstream owner state.

* chore(qa): integrate canonical worker settlement fixes

* commit '7ae69497bec4d9c37f170f046a3cbbf954ff19a7': (6238 commits)
  refactor(ui): replace Systems filters with native menu (#170786)
  fix(browser): browser open honors timeoutMs for its opening navigation (#170053)
  refactor: deslop old Apple shared/macOS and Control UI code (#170823)
  perf(memory): reuse pooled origin readers (#170795)
  fix(crabbox): preserve project snapshots across runtime updates (#170780)
  fix: prevent chat image loading from shifting messages (#170819)
  refactor(ui): use native menus for Secret Store actions (#170663)
  fix(gateway): keep chat metadata available during model reloads (#170805)
  fix: preserve diagnostics for unresponsive state lease heartbeats (#170835)
  fix(test): prepare runtime config for corpus revision proof
  test: give credential fixtures database ownership
  perf(auth): unblock session writes during health preparation (#170807)
  fix(ci): use smaller runners for selected Gateway client tests (#170821)
  fix: use same-commit plugins in development macOS builds (#170776)
  perf(github): share cached reads across sessions and searches (#170825)
  fix(projects): keep listings stable during unrelated session changes (#170824)
  fix(update): update repair fails after Doctor completes on busy macOS hosts (#170779)
  fix(heartbeat): suppress truncated NO_REPLY finals such as NO_R (#170190)
  perf(sessions): reduce read transaction overhead (#170745)
  refactor: simplify older plugin and package lifecycles (#170800)
  ...

* fix(gateway): preserve safe previews and no-op bindings

Clear only the matching pending binding operation after an authoritative unchanged settlement, preserving committed and unknown invalidation fences.

Include the canonical managed-media preview correction from 47ba0ae.

Co-authored-by: Peter Steinberger <[email protected]>

* merge(main): reconcile QA reporting with frozen main

* test(gateway): verify retained route authority after binding settlement

Co-authored-by: Patrick Erichsen <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: Vincent Koc <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 18, 2026
* feat(qa): report scorecard evidence gaps

Distinguish catalog coverage, recorded attempts, and qualified evidence without changing scores or release gates.

Include the canonical compatibility migration-status correction from 3f6d26f.

Co-authored-by: Patrick Erichsen <[email protected]>

* chore(qa): drop compatibility backport already on main

Keep the QA evidence-gap change scoped to its 13 paths. The canonical compatibility correction 3f6d26f and later refinements are already on main; restore the six branch preimages so the merge consumes that upstream owner state.

* chore(qa): integrate canonical worker settlement fixes

* commit '4ae87487b6eca95ac58a2f18de0e742b240772eb': (6238 commits)
  refactor(ui): replace Systems filters with native menu (openclaw#170786)
  fix(browser): browser open honors timeoutMs for its opening navigation (openclaw#170053)
  refactor: deslop old Apple shared/macOS and Control UI code (openclaw#170823)
  perf(memory): reuse pooled origin readers (openclaw#170795)
  fix(crabbox): preserve project snapshots across runtime updates (openclaw#170780)
  fix: prevent chat image loading from shifting messages (openclaw#170819)
  refactor(ui): use native menus for Secret Store actions (openclaw#170663)
  fix(gateway): keep chat metadata available during model reloads (openclaw#170805)
  fix: preserve diagnostics for unresponsive state lease heartbeats (openclaw#170835)
  fix(test): prepare runtime config for corpus revision proof
  test: give credential fixtures database ownership
  perf(auth): unblock session writes during health preparation (openclaw#170807)
  fix(ci): use smaller runners for selected Gateway client tests (openclaw#170821)
  fix: use same-commit plugins in development macOS builds (openclaw#170776)
  perf(github): share cached reads across sessions and searches (openclaw#170825)
  fix(projects): keep listings stable during unrelated session changes (openclaw#170824)
  fix(update): update repair fails after Doctor completes on busy macOS hosts (openclaw#170779)
  fix(heartbeat): suppress truncated NO_REPLY finals such as NO_R (openclaw#170190)
  perf(sessions): reduce read transaction overhead (openclaw#170745)
  refactor: simplify older plugin and package lifecycles (openclaw#170800)
  ...

* fix(gateway): preserve safe previews and no-op bindings

Clear only the matching pending binding operation after an authoritative unchanged settlement, preserving committed and unknown invalidation fences.

Include the canonical managed-media preview correction from f3260b9.

Co-authored-by: Peter Steinberger <[email protected]>

* merge(main): reconcile QA reporting with frozen main

* test(gateway): verify retained route authority after binding settlement

Co-authored-by: Patrick Erichsen <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: Vincent Koc <[email protected]>
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 size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant