Repository navigation
fix(cloud-workers): keep resuming bootstrap downloads that make progress - #162408
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: needs maintainer review before merge. Reviewed October 1, 2026, 12:59 AM ET / 04:59 UTC. ClawSweeper reviewWhat this changesThe PR lets cloud-worker bootstrap downloads continue while retained bytes grow, raises bootstrap tokens to 256 serial serves, and updates regression coverage and troubleshooting guidance. Merge readiness✅ Ready for maintainer review This remains a useful, focused fix: current main still stops progressing bootstrap downloads after three attempts or serves. No actionable introduced defect was found. Priority: P1 Review scores
Verification
How this fits togetherThe Gateway grants temporary access to its runtime archives during cloud-worker preparation. Crabbox downloads and verifies those archives before installing the runtime and connecting the worker. flowchart TD
A[Cloud worker preparation] --> B[Gateway archive grant]
B --> C[Live owner and expiry checks]
C --> D[Full or ranged download]
D --> E{Retained bytes grow?}
E -->|Yes| D
E -->|Three failures without progress| F[Preparation fails]
D --> G[Verify and install archive]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +8, Tests +87, Docs 0. Total +95 across 6 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep progress-aware retries in the existing downloader and preserve the Gateway's live authorization, fixed expiry, exclusive streaming, and archive verification. Do we have a high-confidence way to reproduce the issue? Yes, source establishes the failure path: repeated interrupted downloads can retain additional bytes yet exhaust current main's three attempts or serves. The supplied live failure supports that mechanism; this review did not execute it. Is this the best way to solve the issue? Yes, the patch repairs the existing retry owners without adding configuration or competing implementations, and preserves terminal failures and authorization boundaries. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against c6ea95238634. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
@steipete: a downstream fixture mismatch after this change blocks #120232. The original failure is https://github.com/openclaw/openclaw/actions/runs/36860624890/job/110364125000: The fixture writes one body byte before destroying the response. If that byte is retained, the new no-progress counter correctly permits one progressing attempt followed by three stalled attempts. The producer/test blobs remain unchanged at main Proposed owner repair, not yet executed: make this diagnostic fixture deliberately zero-progress by retaining the positive Content-Length and Keep every current assertion: exactly three authenticated requests for this zero-progress case, failure classification, credential redaction, no node start and complete fixture cleanup. Existing Routing this to the upstream owner under the repository's known-main-CI policy; no standalone test-only PR, production edit, retry campaign or competing executor has been started. Preserve the original failure and qualify only the proposed fixture/affected owner shard through the accepted remote route. |
What Problem This Solves
Fixes cloud worker startup failing behind reset-prone proxies even when each bootstrap download attempt receives more of the archive.
Related: #160655, #160687, #160904.
User Impact
Cloud bootstrap keeps resuming downloads that grow the retained partial file. Three consecutive transient failures without retained byte progress still stop, as do integrity, identity, TLS-pin, and terminal HTTP failures. The core-sized command deadline and two-minute idle timeout remain unchanged; no configuration or migration is required.
Why This Change Was Made
The downloader and bootstrap token each allowed only three attempts/serves. The client now tracks retained byte growth separately from attempts, so progress resets the failure count. Repeated full responses that merely replay the same prefix do not reset it. Busy
transfer_in_progressresponses retain their existing backoff behavior.Bootstrap tokens now allow 256 serial serves. This fixed cap gives a 256 MiB artifact room to complete in roughly 1 MiB increments, while still bounding full-artifact replays. Both completed and interrupted full/ranged responses consume a serve. The original size-derived 45–95 minute lifetime, one-active-transfer limit (busy 503), opaque 404 after expiry/revocation/exhaustion, and enrollment
current()owner checks remain intact. Node-worker bundle transfer tokens remain at one serve.Security: the bearer remains short-lived, owner-revocable, and single-active. More serves only affect a leaked token during its existing window, for the Gateway's own build artifact. Retries do not extend the window or acquire new authority.
Evidence
Maintainer-supplied live evidence from an isolated dev Gateway on main, Crabbox 0.69, Cloudflare quick-tunnel ingress, and three concurrent cold dispatches: GCP provisioning succeeded, but node runtime preparation failed at +920 seconds after
download body failed (ECONNRESET)exhausted attempts 2/3 and 3/3. Each attempt resumed with Range and made progress. A concurrent Hetzner dispatch survived but took about 35 minutes. This PR does not claim a new live cloud run; no Gateways were started or stopped.Fake-time regressions failed against the original production code at base
9680e57a9631b6a7060b9d4642bffb9f9fbc3000: four client cases failed because the third failure stopped the transfer, and three HTTP-boundary cases failed because the fourth serve returned 404. The fixed tests prove five progressing resets complete, progress resets the consecutive failure count, three no-progress failures still stop, and serve 257 returns opaque 404 for both full and ranged responses. Existing expiry, revocation, busy, integrity, and enrollment coverage is retained.Validation: all 133 targeted tests pass across bootstrap-download (46), node-enrollment (28), artifact-transfer-http (42), and worker-bootstrap-artifact-transfer (17). An interim run failed after I incorrectly changed the native enrollment fixture to expect four requests; its immediate reset retains no bytes. That expectation change was removed, and all 28 unchanged enrollment tests passed. The deterministic fake-time tests own the retained-progress assertions.
Measured cost on the loaded Mac with
--maxWorkers=1: the bootstrap-download shard took 5.46 seconds wall (under one second in test bodies); the combined Gateway shard took 56.81 seconds wall, including worker compilation. The changed HTTP test file spent 0.764 seconds in test bodies, including both 256-serve exhaustion cases. CI timing is pending.P2 autoreview is scoped-clean in both pre-commit local mode and the requested branch mode. The committed branch is
aecaaed3292466fa836a89fc923be09ec48516bc.Focused commands (one worker):
The first run passed both Gateway files, then hit the interim enrollment expectation failure described above. The second passed both extension files. The changed-lane runner passed core and extension production types, all 27 core test typecheck shards, extension test types, formatting, six doctor-contract tests, and its completed repository guards. It exceeded the work order's 15-minute host limit and was stopped during the deprecated-API guard (exit 130); the remaining broad guards were not run. Both remaining scoped oxlint commands passed with one thread, and
git diff --check origin/main...HEADpassed. This is the authorized scoped fallback, not a claim that the full changed-check pipeline passed.