Skip to content

fix(crabbox): cloud dispatch fails when a coordinator read needs a retry - #159399

Merged
steipete merged 2 commits into
mainfrom
codex/crabbox-read-budget
Sep 27, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/crabbox-read-budget

Conversation

@steipete

@steipete steipete commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

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 ran crabbox inspect with 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). Local crabbox config show keeps 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

  • Live: repeated manual crabbox inspect --provider aws --id <lease> --json during the incident took 5 s, 2 s, and 33 s (the last printed coordinator read retry 1/4 reason=timeout and then succeeded) — inside Crabbox's budget, outside OpenClaw's old one.
  • New regression crabbox-worker-read-budget.test.ts fails on main (expected 60000 to be greater than 60000) and passes here.
  • node scripts/run-vitest.mjs crabbox-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.
  • tsgo extensions and extension tests lanes passed; formatting passed.
  • Also updated the classless-profile provision envelope in extensions/crabbox/index.test.ts (216 → 217 min + 25 s), which CI caught; timeout-related suites re-run green (122 plugin + 43 core tests).
  • Test cost: 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.

…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.
@clawsweeper

clawsweeper Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime extensions: crabbox size: S labels Sep 27, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 27, 2026
@clawsweeper

clawsweeper Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge. Reviewed September 27, 2026, 2:02 AM ET / 06:02 UTC (Revision 4).

ClawSweeper review

What this changes

Extends 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
Reviewed head: 3f0c0c90c432ac0405b76a1a23aad6066b8217a8

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch aligns with the verified dependency budget and focused checks; the remaining follow-up is CI test-cost disclosure.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: Repository admin-authored PR: the contributor after-fix proof gate does not apply. The incident-era Crabbox CLI retry trace supports the timeout mechanism, and tests check the plugin wiring; no after-fix OpenClaw cloud-dispatch trace is recorded. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Repository admin-authored PR: the contributor after-fix proof gate does not apply. The incident-era Crabbox CLI retry trace supports the timeout mechanism, and tests check the plugin wiring; no after-fix OpenClaw cloud-dispatch trace is recorded. No stored-data contract changes.
Evidence reviewed 9 items Current-main timeout: Fetched main still sets the ordinary Crabbox lifecycle command limit to 60 seconds; the latest release has the same limit.
Latest-release check: The supplied latest release, v2026.9.6, also contains the 60-second lifecycle limit; the proposed repair is not already shipped.
Dependency retry contract: The verified Crabbox repository bounds read-only coordinator retries to one minute and at most five attempts. The PR explicitly depends on this CLI contract.
Findings None None.
Security None None.

How this fits together

A 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]
Loading

Before merge

  • Complete next step (P2) - Add the new regression file's CI seconds to the PR body now that CI has completed.
Agent review details

Security

None.

PR surface

Source +9, Tests +27, Docs +1. Total +37 across 8 files.

View PR surface stats
Area Files Added Removed Net
Source 3 15 6 +9
Tests 4 59 32 +27
Docs 1 1 0 +1
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 8 75 38 +37

Review metrics

Metric Value Why it matters
Lease inspection limit 60 s → 120 s; Machine0 remains 300 s The added headroom covers Crabbox's one-minute retry budget without changing Machine0 readiness.
New test cost 5 cases; 150 s measured one-worker wall time The PR attributes most of that local time to transformation; the required CI seconds have not yet been recorded.

Technical review

Best 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.

Labels

Label changes:

No label changes.

Label justifications:

  • P1: A coordinator retry can fail cloud dispatch after a machine is provisioned and leave a paid lease requiring manual Stop.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Repository admin-authored PR: the contributor after-fix proof gate does not apply. The incident-era Crabbox CLI retry trace supports the timeout mechanism, and tests check the plugin wiring; no after-fix OpenClaw cloud-dispatch trace is recorded. No stored-data contract changes.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Record the new regression file's CI seconds in the PR body.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (3 earlier review cycles)
  • reviewed 2026-09-27T04:06:12.903Z sha 12dcfa1 :: needs changes before merge. :: none
  • reviewed 2026-09-27T04:17:12.725Z sha 12dcfa1 :: needs changes before merge. :: none
  • reviewed 2026-09-27T05:13:50.919Z sha 3f0c0c9 :: needs changes before merge. :: none

@steipete
steipete marked this pull request as ready for review September 27, 2026 04:12
@steipete
steipete merged commit 434a015 into main Sep 27, 2026
97 checks passed
@steipete
steipete deleted the codex/crabbox-read-budget branch September 27, 2026 08:13
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 28, 2026
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation extensions: crabbox gateway Gateway runtime P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant