Repository navigation
feat(workers): reuse completed project setup across cloud sessions - #143227
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed September 9, 2026, 7:23 PM ET / 23:23 UTC (Revision 11). ClawSweeper reviewWhat this changesCloud workers reuse completed project setup at stable workspace and HOME paths, preserve session changes, refresh compatible checkouts, and persist one-session ownership under state schema 17. Warning SQLite table change This PR modifies persisted SQLite tables in Merge readiness⛔ Blocked before merge - 5 items remain This remains a useful, distinct implementation absent from current main. The earlier dedicated-host and setup-overlay findings are resolved; no new blocking correctness defect was established. Priority: P2 Review scores
Verification
How this fits togetherThe Gateway prepares admitted project content and authorized setup before a cloud provider captures a reusable machine image. Fresh workers enroll, bind the prepared workspace to one session, and synchronize changes back to the Gateway. flowchart TD
A[Project commit and setup permission] --> B[Gateway preparation]
B --> C[Completed workspace and HOME]
C --> D[Provider image capture]
D --> E[Fresh enrolled worker]
E --> F[Verify and bind one session]
F --> G[Run commands and reconcile files]
Before merge
Agent review detailsSecurityNone. PR surfacePR surface statistics unavailable: the file list is incomplete. Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Reuse completed setup through the existing provider lifecycle while preserving fixed paths, exact reconciliation, one-session ownership, and the documented schema-17 backup/recovery contract. Do we have a high-confidence way to reproduce the issue? Not applicable as a feature request; current main confirms pristine-seed reuse without this completed-setup capability. The reported reverse-transition timeout has not established a product defect. Is this the best way to solve the issue? Yes: extending the existing preparation and synchronization owners avoids a competing cache flow, and the repaired overlay preserves setup output while keeping checkpoint deletion semantics exact. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 8f6cdd32d63b. 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
HistoryReview history (10 earlier review cycles; latest 8 shown)
|
Prepare project setup and runtime at stable workspace and HOME paths before capture. Bind completed environments to one session, preserve edits on restart, and refresh compatible commits while retaining unrelated caches. Apply the approved complete schema 17 contract; keep ready-pool allocation and repository-only admission separate. Preserve landed upload cancellation, checkpoint outcomes, manifest gzip, and canonical Windows Git configuration. Recover capture requirements after completed setup is replayed following a crash, using existing allocation state. An interrupted warm reuse before enrollment may conservatively capture once more. Final integration passed 305 focused tests, the full changed gate, and scoped P2 review, with earlier broader and cross-process proof retained. Fresh installed-package and native AWS session qualification are pending; no cloud latency claim yet.
f8aac6f to
ae7d8b3
Compare
Preserve a provider's explicit sharedHost=false result through lease normalization so prepared workspaces can register on dedicated nodes. Keep shared and unspecified hosts rejected by the existing admission guard. Cover the actual service creation and parser boundaries, document the provider contract, and align existing dispatch, schema migration, Doctor, and native reader fixtures with the prepared-workspace change. Upgrade-survivor checks retain the exact candidate schema from its admitted tarball instead of assuming the published package's older schema.
|
Merged via squash.
|
…claw#143407) Recognize current session custody before delivery retirement re-admits a local preview. This preserves the displayed image while canonical media loads and retains the fallback for missing or replaced-session custody. The original image detaches when an outbox history receipt precedes the live transcript event. The repaired producer preserves the original handle, pixels, and frame continuity in both receipt-first and event-first orders. Owner/sibling tests, Linux browser proof, changed checks, and independent P2 review passed. Related: openclaw#143227, openclaw#134931
…penclaw#143227) * feat(workers): reuse completed project setup across cloud sessions Prepare project setup and runtime at stable workspace and HOME paths before capture. Bind completed environments to one session, preserve edits on restart, and refresh compatible commits while retaining unrelated caches. Apply the approved complete schema 17 contract; keep ready-pool allocation and repository-only admission separate. Preserve landed upload cancellation, checkpoint outcomes, manifest gzip, and canonical Windows Git configuration. Recover capture requirements after completed setup is replayed following a crash, using existing allocation state. An interrupted warm reuse before enrollment may conservatively capture once more. Final integration passed 305 focused tests, the full changed gate, and scoped P2 review, with earlier broader and cross-process proof retained. Fresh installed-package and native AWS session qualification are pending; no cloud latency claim yet. * fix(workers): retain explicit dedicated host classification Preserve a provider's explicit sharedHost=false result through lease normalization so prepared workspaces can register on dedicated nodes. Keep shared and unspecified hosts rejected by the existing admission guard. Cover the actual service creation and parser boundaries, document the provider contract, and align existing dispatch, schema migration, Doctor, and native reader fixtures with the prepared-workspace change. Upgrade-survivor checks retain the exact candidate schema from its admitted tarball instead of assuming the published package's older schema. * test(ui): wait for image custody before advancing handoff The absence of an error-only send status does not show that custody was established. Wait for the canonical metadata request while the send acknowledgment is held, preserving the original image handle, pixel checks, and frame continuity assertions. * fix(workers): preserve setup output during initial prepared sync
Related: #134931. Follow-ups: #143372 and #143410.
What Problem This Solves
Cloud sessions can reuse a machine image yet repeat project checkout and setup. Relocating the resulting workspace or HOME breaks tools that retain absolute paths. Initial synchronization also needs to preserve setup-generated files that do not exist in the Gateway's pristine checkout.
Why This Change Was Made
Prepare admitted project content, authorized setup, and the node runtime at their final paths before capture. Keep separate pristine and completed manifests. A fresh dedicated node verifies the completed tree and binds its workspace and HOME to one session; reconnects preserve that session's edits, and retirement prevents another session from claiming the binding.
Initial sync applies session changes relative to pristine source over completed setup. Session edits win on changed paths, while untouched generated files and tracked setup edits survive. Reconciliation carries eligible output back to the Gateway. Accepted results and explicit checkpoint restores remain exact, including later deletions.
Same-commit reuse skips checkout and setup. Compatible commit changes refresh source and rerun the authorized recipe while retaining unrelated caches and HOME. Preparation is invalidated before mutation. Persisted allocation state recovers a lost capture requirement after a crash; a narrow pre-enrollment crash window can conservatively add one snapshot. Enrolled replay and replay after capture publication do not add captures. Explicit dedicated-host classification is preserved; missing or shared classification fails admission.
This publishes the complete state schema 17 contract: the node first-use binding table and five nullable Gateway lifecycle fields. The latter remain null in this slice. Ready capacity and repository-only preparation remain separate. The composition preserves the landed upload, checkpoint, compression, capture-deadline, Windows Git, and image-handoff repairs. No UI changes remain in this PR.
User Impact
Later sessions can reuse completed setup at stable paths with fresh enrollment and session isolation. Compatible source changes retain useful caches; bound-session restarts preserve edits. A fresh VM fork still takes minutes in the measured AWS case. The separate ready-pool slice targets the seconds-scale startup goal.
The native reverse-transition proof and cleanup are complete, so the foundation landing hold is lifted. Machine0 and Daytona remain unqualified. The complete schema 17 contract is maintainer-approved: older readers refuse the upgraded database, and rollback requires restoring a verified pre-upgrade backup, which excludes subsequent writes. Existing config remains valid; this slice adds no new user configuration option.
Evidence
Current head:
b5e5e0cd8c1ac7ee282814cadfb74e56128c992c, composed with main7e3a90bf5ce8959843a0758a9151fdef5d1e756e.Exact-head CI passed, without a rerun. The final 100-file changed gate and 121 provider-composition tests passed. The four-file overlay repair separately passed 84 owner/sibling tests, matching regression failure, independent P2 review, and three installed Gateway/node turns covering preservation, reconciliation, and later deletion. Earlier foundation/replay/ownership coverage is retained; overlapping counts are not summed.
Fresh qualification of this commit passed all nine phases, including canonical build/pack, installation, 35,508 installed-file checks, a validated 7,635-entry bootstrap archive, and actual installed Gateway/transferred-worker command correlation with mock inference. A separate installed launch/restart check passed complete per-exec verification. All owned resources stopped. The inherited local fixture stops its node before the Gateway and logs a shutdown warning; this is not an error-free orderly-shutdown claim.
The installed published
[email protected]baseline (1391f7cd, genuine schema 16) upgraded through candidate Doctor to 17 while preserving synthetic worker/credential records and additive data. New lifecycle fields remained null; the node-only table was absent after migration. The actual older Doctor refused 17 with exit 1 without changing config/database bytes. Supported backup restoration recovered schema 16 and pre-upgrade data, excluded later changes, and reached readiness with the matching binary. Both packages stayed unchanged. This covers global state, not per-agent migration or automatic package swap. An initial restored startup used default catalog fetching/shared logging; a fresh restore repeated readiness with catalog refresh disabled and task-local logging. Both attempts remain recorded.Native AWS verified the repaired setup file, real Crabbox Go binary, stable workspace/HOME, session isolation, active Gateway restart, same-commit reuse, and A-to-B refresh. Seven worker turns exited zero with exact command/nonce correlation. Setup counts were 1 → 1 → 2. Cold dispatch to first observed program output was 739.622 seconds; same-commit reuse on a fresh VM took 183.368 seconds; A-to-B refresh took 503.178 seconds. These are transport-inclusive observer measurements using mock inference. Captures took 249.279 seconds and 55.688 seconds.
That native campaign remains failed: its 35-minute execution budget clipped return-to-A preparation to 105.428 seconds of command time, and the final session did not reach a worker command. No remote recipe error was captured. All 76 native commands and 12 local commands settled; all four instances and two snapshots were deleted within the separate cleanup bound, and frozen inputs remained unchanged. The completed cases are retained; the completed two-session B-to-A supplement below covers the missing transition on the same package.
The separate native AWS B-to-A supplement passed, including both actual worker commands and complete cleanup. Build count advanced 1 → 2, the second receipt identified B as its previous commit, and workspace/HOME/cache paths and the HOME marker remained stable. The second VM used the first checkpoint; generated output and the rebuilt A binary matched their exact commit and nonce. Cold B reached first observed program output in 736.038 seconds, and B-to-A refresh in 559.423 seconds; captures took 234.100 seconds and 54.236 seconds. All 43 native and 10 local commands settled, both instances and both snapshots were deleted, and source/package/harness inputs remained unchanged. Proof SHA-256:
72f91538a4b39782a160b00cc371884ba51cce17ab34fda9d155c597e1a503e9. The first supplement failed because its copied fixture lost executable mode; that failed result remains recorded. The corrected fixture verifies mode and recipe admission before allocation. Cached-seed and uploaded-seed paths converge before the same refresh owner; this is aggregate forward/reverse coverage, not a claim that the earlier full three-leg campaign passed.