Repository navigation
feat(nodes): prefetch worker archives before first session - #182115
Conversation
Stage the pinned worker archive on capable persistent hosts after retention pins it. Foreground installation preempts downloads and owns extraction, publication, prewarm, and activation. Preserve session fallback and old-node behavior.
|
🦞👀 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 SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
|
Codex review: needs real behavior proof before merge. What this changesPrefetch verified worker archives on capable persistent nodes while keeping installation and activation owned by session requests. Example: A persistent session host remains connected after a Gateway update.
Review scores
ProductKind: Feature · Worth it: Yes · Fix scope: Partial Merge readiness⛔ Blocked before merge - 4 items remain Keep open: this maintainer-authored PR adds a useful optimization absent from main; source review found no concrete introduced defect. Priority: P2 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherGateway retention maintenance selects eligible paired hosts and grants archive transfer; the node installer verifies and stores bytes, then a session owns extraction, publication, prewarming, and activation. flowchart TD
A[Paired host inventory] --> B[Gateway retention coordinator]
B --> C[Existing bundle installer RPC]
C --> D[Authorized HTTP archive transfer]
D --> E[Verified archive directory]
F[Session request] --> C
E --> G[Session owned installation]
G --> H[Worker activation]
Technical reviewBest possible solution: Keep archive staging within the existing installer and retention owners, preserving session-owned activation and verified upgrade compatibility. Do we have a high-confidence way to reproduce the issue? Current-main source confirms that a missing worker build is acquired under the first session request; current deployment latency was not reproduced. Is this the best way to solve the issue? Archive-only staging is a focused extension of existing owners and preserves execution custody, but it addresses acquisition rather than the broader preparation and activation delay. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against ac9625c0d76e. Merge-risk optionsMaintainer options:
Provenance checked
TestingProof path: in-process harness. SecurityNeeds attention: No concrete authorization bypass was found, but the new connection-owned transfer lifetime requires final-effect proof. EvidenceWhat I checked:
PR surfaceSource +170, Tests +251, Docs +7. Total +428 across 16 files. Added test files: 0. View PR surface stats
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 23, 2026, 10:53 PM ET / October 24, 2026, 02:53 UTC. |
…es (openclaw#182115) After a Gateway update, the first session on each persistent node paid the full worker-bundle download (about 24 s measured in openclaw#140449). Nodes that negotiate the new capability now receive a low-priority, archive-only prefetch: the node downloads and verifies the pinned bundle archive but never extracts, repairs, publishes or activates it; a session's own install preempts any in-flight prefetch and reuses the verified archive. Prefetch failures are warnings only, old nodes keep the session-owned install, and existing retention handles the archive. Fixes openclaw#140425
Fixes #140425
What Problem This Solves
The first session on a persistent node after a Gateway update still has to acquire the new worker archive, even when the node has been connected and idle.
User Impact
Capable persistent paired nodes now prefetch and verify the current pinned archive in the background. A session preempts an unfinished prefetch or reuses its completed archive. Failed prefetch and older nodes retain normal session-owned installation. Extraction, worker publication, prewarm, and activation remain owned by the session; this does not eliminate all first-start preparation time. No new configuration option is needed.
Why This Change Was Made
This deliberately revisits the background-installation boundary from #140449 using a negotiated archive-only mode in the existing bundle RPC. Prefetch never extracts or executes worker code, so it cannot publish or prewarm a runtime under a superseded enrollment owner. Downloads and verification are cancellable; foreground installation aborts background work before taking the node's installation queue. Gateway preparation is bounded to one attempt per node, connection, and build, is cancelled on disconnect, enrollment takeover, transport replacement, and shutdown, and warns on failure without a retry loop.
Maintenance pins the current hash before prefetch. The archive occupies the existing hash directory without an installation receipt and follows normal bounded bundle retention; no second cache, state store, dependency, or retention policy is introduced. Each session verifies staged bytes and falls back to acquisition if staging is absent or corrupt. Optional capability negotiation preserves older-node and older-Gateway behavior and excludes disposable cloud hosts.
Evidence
pnpm test src/gateway/worker-environments/node-workspace-retain-coordinator.test.ts src/gateway/worker-environments/node-worker-bundle-installer.test.ts src/node-host/connection.test.ts src/infra/node-runner-inventory.test.ts --maxWorkers=1: 96 passed, 299.81 seconds wall time including the first compiled worker-cache preparation.pnpm test src/node-host/node-worker-bundle-installer.test.ts src/worker/node-bundle-install-protocol.test.ts src/gateway/worker-environments/node-workspace-retain-coordinator.test.ts --maxWorkers=1: 90 passed, 21.51 seconds wall time. The earlier native/protocol run also passed all 51 tests in 19.51 seconds.git diff --checkpass. Independent Codex review found no actionable P0–P2 findings; subsequent changes only correct mechanical lint issues.