Repository navigation
fix(cloud-workers): size node enrollment deadlines from the bootstrap window - #160904
Conversation
Carry optional core timing facts into provider budgets before allocation and into artifact-specific Crabbox commands and HTTP requests. Size concurrent runtime downloads from their combined bytes while retaining separate connection, scrub, diagnostics, settlement, and cleanup allowances. Keep the existing pairing credential lifetime: enrollment closure does not revoke its bearer. Document that remaining limit rather than extending it.
…ttempts Use a two-minute socket inactivity timeout so stalled bootstrap downloads retry and resume retained bytes, while progressing transfers share only the core-owned command deadline. Remove the unused script timeout argument without changing the grant or command budgets. Fake-time proof covers 48/46-minute progressing transfers and header/body stalls; the origin/main negative control fails all three cases. The crabbox enrollment/provider suites and downloader suite pass 315 tests total. Extension production/test typechecks, changed-file formatting/lint, and P2 candidate autoreview pass.
|
🦞👀 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: needs maintainer review before merge. Reviewed September 28, 2026, 10:43 PM ET / September 29, 2026, 02:43 UTC. ClawSweeper reviewWhat this changesThis PR gives cloud-worker enrollment a size-derived command window and replaces Crabbox’s fixed HTTP attempt deadline with a two-minute inactivity timeout. Merge readiness✅ Ready for maintainer review Keep open. Current main has the earlier download-resume and transfer-lifetime fixes, but still has the fixed command and per-attempt deadlines this PR addresses. The patch is coherent, and this review found no definite introduced defect. Priority: P1 Review scores
Verification
How this fits togetherThe Gateway prepares cloud-worker archives and grants temporary HTTP download access. Crabbox downloads and installs those archives on a remote machine, then waits for the node to pair and become available. flowchart LR
A[Cloud worker dispatch] --> B[Core bootstrap window]
B --> C[Artifact grants]
B --> D[Crabbox command deadline]
C --> E[HTTP downloads]
D --> F[Remote setup]
E --> F
F --> G[Node pairing]
G --> H[Available worker]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +49, Tests +113, Docs +4. Total +166 across 20 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep timeout policy in the Gateway and let Crabbox consume its bounded timing facts; address pairing beyond ten minutes through a separate owner-bound credential design. Do we have a high-confidence way to reproduce the issue? Yes. Current-main source shows the fixed command and request deadlines, and the supplied slow-tunnel trace reports the command timing out. I did not execute that path in this read-only review. Is this the best way to solve the issue? Yes for the deadline mismatch: the existing core policy computes the window and Crabbox consumes it with an optional fallback. The separate pairing-credential limit remains documented. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against ae6a88438de3. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
… window (openclaw#160904) * fix(cloud-workers): derive enrollment deadlines from bootstrap windows Carry optional core timing facts into provider budgets before allocation and into artifact-specific Crabbox commands and HTTP requests. Size concurrent runtime downloads from their combined bytes while retaining separate connection, scrub, diagnostics, settlement, and cleanup allowances. Keep the existing pairing credential lifetime: enrollment closure does not revoke its bearer. Document that remaining limit rather than extending it. * fix(crabbox): detect stalled bootstrap downloads instead of capping attempts Use a two-minute socket inactivity timeout so stalled bootstrap downloads retry and resume retained bytes, while progressing transfers share only the core-owned command deadline. Remove the unused script timeout argument without changing the grant or command budgets. Fake-time proof covers 48/46-minute progressing transfers and header/body stalls; the origin/main negative control fails all three cases. The crabbox enrollment/provider suites and downloader suite pass 315 tests total. Extension production/test typechecks, changed-file formatting/lint, and P2 candidate autoreview pass.
|
Live follow-up on
Before this series, the same cell failed with ECONNRESET followed by 404 (fixed-lifetime token), then with a first-turn bundle ENOENT, then with the 15-minute enrollment timeout on a ~160 KB/s tunnel. Caveat: this run's tunnel was about twice as fast as the timed-out one, so it proves the complete cold path end to end rather than isolating the deadline change. The deadline itself is covered by the fake-time regressions in this PR. |
What Problem This Solves
Cold cloud-worker enrollment over a slow Gateway uplink (a home connection, or a Cloudflare quick tunnel as
gateway.publicOrigin) could not finish. Live, with #160655 and #160687 in place, a Crabbox Hetzner cold dispatch over a ~160 KB/s tunnel resumed its interrupted download correctly (Range, no 404), but was killed at +1,105 s:The node bootstrap artifact (~45 MB) and the worker bundle (~28 MB) download concurrently. Crabbox capped the whole enrollment command at a fixed
CRABBOX_NODE_ENROLLMENT_TIMEOUT_MS = 15 min, which also covers Node/npm install and setup. Core already sizes these same transfers from their byte counts (125 KB/s floor,workerBootstrapOperationTimeoutMs), so the plugin's fixed deadline contradicted core's own transfer policy. Each HTTP attempt also had a hard 10-minute cap, so three attempts could not move 250 MB at the floor rate.User Impact
Slow-uplink Gateways can enroll cold cloud workers. Stalled download connections are detected within two minutes and resumed from the last byte, and slow-but-progressing transfers are never cut by a per-attempt limit.
Why This Change Was Made
bootstrap.tsintobootstrap-timeouts.ts, and all consumers are migrated. Node enrollment grants now carry a core-ownedbootstrapTimeoutMs, sized from the combined bytes of the artifacts that download concurrently through one uplink. That window also sizes both transfer tokens.MAX_NODE_BOOTSTRAP_TIMEOUT_MS: the largest operation window plus the node connection wait) toresolveProvisionTimeoutMsandprovision, and the outer budget can always contain the derived command deadline.AbortSignal.timeout. A two-minute socket inactivity timeout raises a transientETIMEDOUT, so the existing retry and Range resume continue from the partial file. Attempt count, authority checks, busy-503 handling, integrity verification and cleanup are unchanged.WorkerNodeBootstrapAccess.bootstrapTimeoutMs, provision optionnodeBootstrapTimeoutMs, and an optional second argument toresolveProvisionTimeoutMs), documented indocs/plugins/sdk-overview/capabilities.md. They add no authority, subpath, protocol or schema.Not changed: the node pairing credential keeps its 10-minute lifetime. Enrollment closure does not currently revoke it (redemption checks durable environment eligibility, not the live enrollment binding), so extending it would widen that gap. That is tracked separately. Until then, a cold enrollment whose downloads take longer than 10 minutes can still fail at pairing; the docs say so.
Evidence
main: grant timing facts are missing, a 900,000 ms vs 5,700,000 ms command deadline, an insufficient outer budget, and progressing transfers cut by the old attempt caps (3 of 42 download cases fail).main: 119 + 42 passed.OPENCLAW_*count is 476/476, and oxfmt/oxlint andgit diff --checkare clean. Codex autoreview P2 is scoped-clean in branch mode for both commits.