fix(worker): stop invalid Spot requests from retrying On-Demand - #1252
Conversation
|
Codex review: passed. Reviewed August 10, 2026, 3:01 PM ET / 19:01 UTC. ClawSweeper reviewWhat this changesThe PR restricts AWS Spot-to-On-Demand fallback to candidates whose individual failures are capacity, quota, or explicitly Spot-specific recoverable errors. Merge readinessKeep open. Current main still performs an On-Demand pass over every candidate after retryable Spot failures; this PR replaces that behavior in both direct AWS and Worker provisioning, with focused regression coverage and no blocking patch defect found. Priority: P2 Review scores
Verification
How this fits togetherCrabbox provisions remote AWS machines through both its Go CLI and Cloudflare Worker coordinator. Capacity configuration feeds candidate instance launches; classified Spot failures decide whether an eligible candidate receives an On-Demand retry or the request returns an error. flowchart LR
A[Capacity configuration] --> B[AWS instance candidates]
B --> C[Spot launch attempts]
C --> D[Failure classification]
D -->|Market recoverable| E[Eligible On-Demand retry]
D -->|Terminal or market independent| F[Return provisioning error]
E --> G[Provisioned machine or error]
Before merge
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the per-candidate classifier after required checks complete, preserving the documented capacity, quota, and explicit-Spot cases and adding new AWS error forms only with matching direct and Worker regression coverage. Do we have a high-confidence way to reproduce the issue? Yes. Current main’s full-candidate On-Demand loop is directly visible in source, and the PR’s focused harness exercises invalid, opaque, mixed-candidate, and UnfulfillableCapacity paths; this review did not execute the harness. Is this the best way to solve the issue? Yes. Per-candidate market classification is the narrowest maintainable repair: it preserves known recoverable Spot cases while preventing On-Demand retries for request errors unrelated to market selection. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against f445f43a7696. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (35 earlier review cycles; latest 8 shown)
|
|
@clawsweeper automerge |
|
🦞👀 Source: I left the PR open for the remaining gate instead of bypassing it. Automerge progress:
|
4c4549d to
3de9496
Compare
3de9496 to
d03ceb5
Compare
|
Merged and verified. The final fix uses a market-specific, per-candidate fallback contract in both direct AWS and the Worker coordinator. During review we corrected three subtle gaps in the original patch: Local proof:
GitHub proof:
No live AWS instance was created. The deterministic request harness verifies the actual Spot versus On-Demand |
What problem this solves
AWS Spot-to-On-Demand fallback could retry market-independent request failures as On-Demand, while also missing AWS's
UnfulfillableCapacitySpot-capacity error.What changed
UnfulfillableCapacity, and request errors that explicitly identify Spot as unsupported.Verification
go vet ./...go test -race ./...npm run format:check --prefix workernpm run lint --prefix workernpm run check --prefix workernpm run check:node --prefix workernpm test --prefix workerscripts/check-docs.shThe original Worker fix and regression harness were contributed by @vincentkoc; the branch was refreshed and extended with the market-specific direct/Worker alignment and mixed-chain coverage.