Repository navigation
fix(workers): resume interrupted bootstrap downloads - #160655
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 28, 2026, 3:11 PM ET / 19:11 UTC (Revision 2). ClawSweeper reviewWhat this changesThe branch adds bounded byte-range responses to the Gateway artifact route and makes Crabbox bootstrap downloads retain partial archives, resume them, and verify the completed file; it also updates tests and troubleshooting guidance. Merge readiness⛔ Blocked before merge - 1 item remains Keep open: the merged retry fix still downloads from byte zero after an interruption, so this follow-up remains useful. The latest commit resolves the prior one-serve objection, and I found no blocking patch defect. Priority: P1 Review scores
Verification
How this fits togetherThe Gateway grants short-lived access to worker runtime archives and streams them over HTTP. Crabbox's setup script downloads those archives, verifies their contents, and installs the worker runtime. flowchart LR
A[Bootstrap artifact grant] --> B[Gateway artifact route]
B --> C[Full or ranged bytes]
C --> D[Crabbox downloader]
D --> E{Transfer interrupted?}
E -->|Yes| F[Retained partial file]
F --> B
E -->|No| G[Size and hash verification]
G --> H[Runtime installation]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +40, Tests +135, Docs 0. Total +175 across 5 files. View PR surface stats
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. Technical reviewBest possible solution: Keep byte-range resume within the existing bootstrap grants, with full-response fallback, complete-file verification, and the node-bundle one-serve rule preserved. Do we have a high-confidence way to reproduce the issue? Yes, from source: interrupt a current-main download after partial delivery and its next attempt starts a full GET because the partial file is removed. This read-only review did not execute that replay. Is this the best way to solve the issue? Yes. The change stays with the existing Gateway transfer and Crabbox setup owners, preserves grant limits, and leaves the one-serve node-bundle installer alone. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 28340c41f8b8. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
Node worker bundle tokens allow one serve and the archive lives in a per-call staging directory, so a retry with bytes on disk can never be authorized. Keep ranged resume on the three-serve bootstrap path only, and let a zero-byte artifact without Range still serve 200.
artifact-transfer-http.test.ts vs #160655: progress test adapted to the options-object serve helper. Adapt the refresh-wait launcher fixture to the shared tunnel and reconciliation helpers after main fixture consolidation removed its direct imports.
* fix(workers): resume interrupted bootstrap downloads * refactor(node-host): drop unreachable bundle range resume Node worker bundle tokens allow one serve and the archive lives in a per-call staging directory, so a retry with bytes on disk can never be authorized. Keep ranged resume on the three-serve bootstrap path only, and let a zero-byte artifact without Range still serve 200.
What Problem This Solves
Fixes cloud worker bootstrap downloads exhausting their retries when a slow connection or buffering proxy repeatedly resets the response body.
Related: #159546.
User Impact
Interrupted bootstrap downloads retain received bytes and request the remainder, allowing preparation to finish within the existing retry window. A server that ignores Range safely replaces the partial file; inconsistent ranges restart cleanly, and complete-file integrity failures still stop installation.
Why This Change Was Made
The shared artifact route now accepts only a single open-ended
Range: bytes=N-, returns 206 with the exact remaining length and Content-Range, and rejects unsupported or unsatisfiable ranges with 416. The generated Crabbox setup script retains its partial file across transient failures and verifies the complete archive against its descriptor's SHA-256 before installation. The node-host bundle installer is intentionally unchanged: its one-serve token is revoked after the first authorized attempt and its archive lives in a per-call staging directory, so a ranged retry there could never be authorized.Security: no new capability, lifetime, or serve budget. Ranges only reduce bytes per serve. Bootstrap tokens retain three serial serves and their 10-minute lifetime; node bundle tokens retain one serve and their existing operation window. Each accepted ranged request consumes a serve. Live authority, revocation, exclusivity, and bootstrap busy-503 handling are unchanged.
Evidence
node scripts/run-vitest.mjs extensions/crabbox --maxWorkers=4: 874 passed, 13 skipped; 133.63s wall.src/gateway/worker-environments(10 files, four workers): 149 passed; 84.72s wall.gateway-other,other), targeted core/extension lint, formatting, andgit diff --checkpassed. P2 Codex autoreview is scoped-clean after correcting its finding about terminal full-response length mismatches.pnpm tsgo:core:testandnode scripts/check-changed.mjsstop at a pre-existing TS2741 insrc/gateway/session-row-projection.config-commits.test.ts:76(missing requiredscheduler). That test andconfig-reload.tsare unchanged from the base and observedorigin/main; the touched test graphs pass. All changed-file checks before that failure passed.Rangeon HTTP 200; affected suites re-run green (artifact-transfer-http 25, bundle-transfer + installer 25, bootstrap download 39) and Codex autoreview is scoped-clean on the final branch.Single-worker cost, measured with
pnpm test <file> --maxWorkers=1(wall includes wrapper/import preparation):src/gateway/worker-environments/artifact-transfer-http.test.tsextensions/crabbox/src/crabbox-worker-bootstrap-download.test.tsCI timing is pending the initial PR run. No workflow was dispatched or rerun for proof.