Repository navigation
fix(crabbox): cloud dispatch fails when a coordinator read needs a retry - #159399
Conversation
…etries Crabbox bounds each read-only coordinator request at one minute including retries (coordinatorReadBudget). OpenClaw ran inspect with the same 60 s limit, so a slow first read made OpenClaw kill Crabbox mid-retry and fail a dispatch whose machine was already provisioned. Give read-bound lifecycle commands the Crabbox read budget plus a startup margin, keep local config show at 60 s, express the Machine0 budget in the same terms, and apply the budget to Crabbox sandbox inspection too.
|
🦞👀 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 changes before merge. Reviewed September 27, 2026, 2:02 AM ET / 06:02 UTC (Revision 4). ClawSweeper reviewWhat this changesExtends Crabbox cloud-worker and sandbox lease-inspection deadlines, retains the local configuration-read limit, and updates tests and troubleshooting guidance. Merge readiness⛔ Needs changes before merge - 1 item remains Keep open. Current main and the latest release still allow OpenClaw to terminate lease inspection while Crabbox is retrying a coordinator read. The proposed repair is focused, and this review found no blocking code defect. Priority: P1 Review scores
Verification
How this fits togetherA cloud-session dispatch asks the bundled Crabbox plugin to provision and inspect a leased machine. The plugin runs the Crabbox CLI and returns the lease state to the Gateway before worker enrollment continues. flowchart TD
A[Cloud session dispatch] --> B[Crabbox worker plugin]
G[Provision deadline] --> B
B --> C[Lease inspection command]
C --> D[Coordinator read retries]
D --> E[Lease status]
E --> F[Worker enrollment]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +9, Tests +27, Docs +1. Total +37 across 8 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep the plugin's inspection command budget longer than Crabbox's coordinator retry window while preserving the overall provisioning deadline and cleanup reserves. Do we have a high-confidence way to reproduce the issue? Yes, the source gives a high-confidence path: a delayed coordinator read can consume the old 60-second process limit before Crabbox finishes retrying. The incident trace matches that mechanism; this read-only review did not run a current-main dispatch. Is this the best way to solve the issue? Yes. Adjusting the bundled plugin's command budget and its existing provider envelope is a narrow repair that adds no competing retry policy or configuration surface. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 5e1a2cf4ea76. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
|
Merged via squash.
|
…try (openclaw#159399) * fix(crabbox): let lease inspection outlast Crabbox coordinator read retries Crabbox bounds each read-only coordinator request at one minute including retries (coordinatorReadBudget). OpenClaw ran inspect with the same 60 s limit, so a slow first read made OpenClaw kill Crabbox mid-retry and fail a dispatch whose machine was already provisioned. Give read-bound lifecycle commands the Crabbox read budget plus a startup margin, keep local config show at 60 s, express the Machine0 budget in the same terms, and apply the budget to Crabbox sandbox inspection too. * test(crabbox): account for the read budget in the classless provision envelope
What Problem This Solves
Fixes: a cloud session dispatch fails after its Crabbox machine is already provisioned when the Crabbox coordinator answers the first lease-inspection read slowly.
User Impact
User impact: cloud sessions on Crabbox profiles no longer fail (and leave a running machine waiting for Stop) just because one coordinator read had to be retried. Live example on an AWS profile: warmup succeeded, then dispatch failed after 423 s with
Crabbox inspect did not exit normally (timeout): coordinator read retry 1/4 reason=timeout context canceled …, automatic teardown also hit coordinator deadlines, and the paid lease stayed active until the session was stopped manually.Why This Change Was Made
Crabbox owns read retries: every read-only coordinator request gets a one-minute total budget with up to five 30-second attempts (
coordinatorReadBudget,internal/cli/coordinator_read_retry.go). OpenClaw rancrabbox inspectwith exactly 60 seconds, leaving no room for process startup on a loaded host, so it terminated Crabbox while Crabbox was still retrying. The timeouts module now names Crabbox's read budget and gives read-bound lifecycle commands that budget plus a one-minute startup/exit margin (120 s). Localcrabbox config showkeeps 60 s, the Machine0 readiness budget is expressed in the same terms (unchanged 5 min), and Crabbox sandbox inspection uses the same lifecycle budget. The overall provision deadline still bounds every read, and core already derives its provider-call deadline from the plugin's budget.Evidence
crabbox inspect --provider aws --id <lease> --jsonduring the incident took 5 s, 2 s, and 33 s (the last printedcoordinator read retry 1/4 reason=timeoutand then succeeded) — inside Crabbox's budget, outside OpenClaw's old one.crabbox-worker-read-budget.test.tsfails on main (expected 60000 to be greater than 60000) and passes here.node scripts/run-vitest.mjscrabbox-worker-provider + desktop + read-budget: 266 + 5 passed; sandbox backend + read-budget: 17 passed;src/gateway/worker-environments/provider-provisioning.replay.test.ts: 21 passed.extensionsandextension testslanes passed; formatting passed.extensions/crabbox/index.test.ts(216 → 217 min + 25 s), which CI caught; timeout-related suites re-run green (122 plugin + 43 core tests).pnpm test extensions/crabbox/src/crabbox-worker-read-budget.test.ts --maxWorkers=1→ 5 tests, 150 s total duration of which 88% transform (host load ~55); test execution itself is sub-second with fake command runners and no timers.