Skip to content

fix(crabbox): slow coordinator reads and unsupported backends no longer strand cloud workers - #164231

Merged
steipete merged 2 commits into
mainfrom
steipete/cs-setup-retry-20261003
Oct 3, 2026
Merged

steipete merged 2 commits into
mainfrom
steipete/cs-setup-retry-20261003

Conversation

@steipete

@steipete steipete commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes healthy cloud workers failing on coordinator reads before setup starts, and fresh unsupported-backend requests accumulating cleanup for machines that were never created.

User Impact

Transient coordinator timeouts recover on the same lease. Backends without fixed lease ID support fail with actionable guidance without starting a teardown loop for a fresh request. Earlier uncertain allocations retain their cleanup responsibility. No timeout, budget, configuration, or SDK changes are required.

Why This Change Was Made

The command owner retries only complete coordinator-timeout diagnostics that prove the script never started. Profile setup, node runtime preparation, node enrollment setup, inspect/readiness, heartbeat, and stop share at most three attempts with 1s/2s backoff inside the original phase budget. Any script output prevents retry; exhaustion preserves the diagnostic and attempt count. Allocation remains owned by provisioning replay.

The exact backend-matching exit-2 capability refusal uses the permanent provider-rejection contract. Crabbox rejects it before Warmup/Acquire. Core distinguishes a fresh request from replay so a later refusal cannot erase an earlier uncertain allocation. Missing or mismatched local claims are not proof of remote absence, so they cannot discharge cleanup responsibility.

Main integration preserves diagnostic redaction, first-boot package-manager guidance, and ordinary runtime preparation before enrollment. The added runtime-preparation phase uses the same fixed-lease script command and classifier. Its regression extends the existing provider-flow table and archive fixtures.

Evidence

Operator-observed coordinator timeouts occurred after healthy Hetzner/AWS allocations reached ready and before setup/enrollment script execution. Unsupported fixed-ID backends then entered repeated cleanup despite no fresh allocation. Provider diagnostics and lease identifiers in the tests are synthetic.

The added ordinary-runtime case failed before the selector fix with Crabbox node runtime preparation failed and cleanup_complete. It now recovers after two coordinator timeouts, enrolls on the original lease, and does not stop or allocate another machine. Existing regressions cover exhaustion, script-output rejection, cancellation, stop classification, fresh capability refusal, other exit-2 failures, and preserved cleanup responsibility across restart.

Post-rebase local proof, each run with pnpm test <file> --maxWorkers=1:

Test file Result Wall time
extensions/crabbox/src/crabbox-worker-coordinator-retry.test.ts 12 passed 96.22s
extensions/crabbox/src/crabbox-worker-command.test.ts 51 passed 32.49s
extensions/crabbox/src/crabbox-worker-enrollment-overlap.test.ts 2 passed 53.93s
src/gateway/worker-environments/provider-crabbox-runtime-preflight.test.ts 20 passed 188.97s

Most extension-suite wall time is compiler preparation and module setup; the retry cases themselves take milliseconds and use the existing injected sleep. The Gateway suite exercises real bundled-provider registration, persisted state, and restart to prove cleanup responsibility across that boundary.

node scripts/check-changed.mjs ran the full changed-check plan. Its first run caught a missing required worker-bundle field in the new test grant; the existing archive fixture now supplies it, and extension test types passed on recheck (6.21s). Extension lint caught an unnecessary object spread in that same case; the direct conditional replacement passed targeted lint over all five changed Crabbox files (101.55s) and the full retry test file. All other planned formatting, core/extension production and test typechecks, dead-export scans, core/script lint, doctor-contract tests, and architecture/auth guards passed. SDK boundary declaration preparation succeeded; no declaration deferral is needed. Git hooks remained enabled, and git diff --check passed.

Independent P1 review found no actionable issues in the original patch or substantive runtime-preparation follow-up. The subsequent lint-only conditional simplification was manually inspected and rechecked.

The previous head 4b72e69e15d33d83875e41f5e63ae3f44d58dbc9 passed CI run 37115787383. Exact-head CI run 37119742895 also passed on candidate 748d1b334e41ba65a0251d003378b76c528b6df6 (403 seconds elapsed for the complete CI run); the native watcher reported a green rollup. No live cloud allocation was run for this patch.

@clawsweeper

clawsweeper Bot commented Oct 3, 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: L labels Oct 3, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 3, 2026
@clawsweeper

clawsweeper Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed October 3, 2026, 8:04 AM ET / 12:04 UTC (Revision 5).

ClawSweeper review

What this changes

The PR retries qualifying Crabbox coordinator timeouts within existing command budgets and distinguishes fresh unsupported-backend refusals from uncertain allocation replays.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⛔ Blocked before merge - 3 items remain

The work remains useful, but the previously reported warm-image reservation leak is still present at the reviewed head and blocks merge.

Priority: P2
Reviewed head: 748d1b334e41ba65a0251d003378b76c528b6df6

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The focused reliability patch has substantial validation, but the unresolved persistent reservation leak prevents merge readiness.
Proof confidence 🌊 off-meta tidepool Not applicable: The MEMBER-authored PR is exempt from contributor runtime proof. Its supplied validation exercises production provider and lifecycle owners with mocked Crabbox commands and persisted restart fixtures, not a real transport; no live allocation is claimed. No stored-data format or schema changes are introduced.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The MEMBER-authored PR is exempt from contributor runtime proof. Its supplied validation exercises production provider and lifecycle owners with mocked Crabbox commands and persisted restart fixtures, not a real transport; no live allocation is claimed. No stored-data format or schema changes are introduced.
Evidence reviewed 9 items Introduced refusal bypass: The introduced exact capability-refusal branch throws a plain WorkerProviderError before returning to the warm-image allocation owner; it does not settle a reservation.
Reservation precedes warmup: Warm-image-enabled allocation calls selectAllocation before runProvisionWarmup. Selection persists a pending allocation even when its choice is cold, and no refusal catch removes it.
Persistent capacity consequence: The allocation store limits each profile to 256 reservations. Core terminalizes the fresh permanent refusal as failed with no returned lease, and ordinary destroy returns immediately for that terminal record instead of invoking the plugin’s release path.
Findings 1 actionable finding [P2] [P2] Release fresh warm-image reservations before terminalizing refusal
Security None None.

How this fits together

OpenClaw’s cloud-worker lifecycle asks the Crabbox plugin to allocate, prepare, enroll, and release remote machines. The plugin records warm-image allocation reservations before contacting Crabbox, while core records worker progress and cleanup responsibility.

flowchart TD
  A[Cloud worker request] --> B[Gateway lifecycle]
  B --> C[Crabbox allocation reservation]
  C --> D[Crabbox command]
  D --> E{Command outcome}
  E --> F[Bounded timeout retry]
  F --> D
  E --> G[Worker enrollment]
  E --> H[Refusal or cleanup settlement]
Loading

Before merge

  • [P2] Release fresh warm-image reservations before terminalizing refusal (P2) - With warm images enabled and no reusable checkpoint, warmImages.allocate() persists a pending reservation before calling this warmup path. This plain WorkerProviderError makes core terminalize a fresh request as failed without a lease ID; ordinary destroy then returns immediately, so the plugin never releases the reservation. Repeated refused requests exhaust the profile’s 256-allocation capacity. The previously reported blocker remains unresolved, and the refusal tests still set warmImage:false. Settle only the reservation created by this definitively refused fresh attempt, preserving reservations from earlier uncertain attempts.
  • Resolve merge risk (P1) - Repeated fresh capability refusals with warm images enabled retain unreachable persistent reservations and can exhaust the profile’s allocation capacity.
  • Complete next step (P2) - Repair fresh refusal reservation settlement and add warm-image-enabled coverage proving that earlier uncertain reservations remain intact.

Findings

  • [P2] [P2] Release fresh warm-image reservations before terminalizing refusal — extensions/crabbox/src/crabbox-worker-provision-commands.ts:160-163
Agent review details

Security

None.

PR surface

Source +110, Tests +458, Docs +8. Total +576 across 11 files.

View PR surface stats
Area Files Added Removed Net
Source 4 121 11 +110
Tests 4 459 1 +458
Docs 3 8 0 +8
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 11 588 12 +576

Review metrics

Metric Value Why it matters
Production versus regression growth production net +110 lines; tests net +457 lines Production growth implements a shared bounded retry policy, while the larger regression investment still omits warm-image-enabled refusal settlement.

Merge-risk options

Maintainer options:

  1. Settle only the fresh reservation (recommended)
    Remove the reservation established by a definitively refused fresh warmup and prove that uncertain replay reservations remain available for cleanup.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Repair fresh unsupported-backend refusal settlement in the warm-image allocation owner; preserve prior uncertain reservations and add a failing-before warm-image-enabled regression proving local settlement without remote teardown.

Technical review

Best possible solution:

Settle the reservation created by a definitively refused fresh attempt locally, while preserving reservations belonging to earlier uncertain allocations.

Do we have a high-confidence way to reproduce the issue?

Yes, source establishes the introduced failure: enable warm images with no reusable checkpoint, return the exact backend capability refusal, and observe the pending reservation surviving terminal failure and ordinary destroy. This review did not execute that scenario.

Is this the best way to solve the issue?

The shared retry owner and replay distinction are appropriate, but the refusal path is incomplete because it settles core state without settling the fresh plugin reservation.

Full review comments:

  • [P2] [P2] Release fresh warm-image reservations before terminalizing refusal — extensions/crabbox/src/crabbox-worker-provision-commands.ts:160-163
    With warm images enabled and no reusable checkpoint, warmImages.allocate() persists a pending reservation before calling this warmup path. This plain WorkerProviderError makes core terminalize a fresh request as failed without a lease ID; ordinary destroy then returns immediately, so the plugin never releases the reservation. Repeated refused requests exhaust the profile’s 256-allocation capacity. The previously reported blocker remains unresolved, and the refusal tests still set warmImage:false. Settle only the reservation created by this definitively refused fresh attempt, preserving reservations from earlier uncertain attempts.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 063685e96d00.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is a bounded cloud-worker reliability repair with a profile-specific reservation leak remaining before merge.
  • merge-risk: 🚨 availability: The new terminal refusal can strand allocation reservations until the profile rejects further warm-image allocations.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: The MEMBER-authored PR is exempt from contributor runtime proof. Its supplied validation exercises production provider and lifecycle owners with mocked Crabbox commands and persisted restart fixtures, not a real transport; no live allocation is claimed. No stored-data format or schema changes are introduced.

Evidence

Acceptance criteria:

  • [P1] pnpm test extensions/crabbox/src/crabbox-worker-coordinator-retry.test.ts --maxWorkers=1.
  • [P1] pnpm test extensions/crabbox/src/crabbox-worker-warm-image-allocation.test.ts --maxWorkers=1.
  • [P1] pnpm test src/gateway/worker-environments/provider-crabbox-runtime-preflight.test.ts --maxWorkers=1.
  • [P1] node scripts/check-changed.mjs.
  • [P1] git diff --check.

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.

  • Add a failing-before warm-image-enabled regression proving fresh refusal removes its new reservation without remote teardown and preserves uncertain replay reservations.

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 (4 earlier review cycles)
  • reviewed 2026-10-03T10:00:10.171Z sha 89cd7b421d9a7c0e1dbdfb3158845e8915605d8d :: blocked before merge. :: [P2] Release fresh warm-image reservations before terminalizing refusal
  • reviewed 2026-10-03T10:22:47.731Z sha 4b72e69e15d33d83875e41f5e63ae3f44d58dbc9 :: blocked before merge. :: [P2] [P2] Release fresh warm-image reservations before terminalizing refusal
  • reviewed 2026-10-03T11:35:02.019Z sha 748d1b3 :: blocked before merge. :: [P2] [P2] Release fresh warm-image reservations before terminalizing refusal
  • reviewed 2026-10-03T11:47:48.990Z sha 748d1b3 :: blocked before merge. :: [P2] [P2] Release fresh warm-image reservations before terminalizing refusal

Include ordinary runtime preparation in the existing fixed-lease coordinator retry policy. Extend the provider-flow regression and document the phase without changing timeouts, budgets, or allocation ownership.
@steipete
steipete force-pushed the steipete/cs-setup-retry-20261003 branch from 4b72e69 to 748d1b3 Compare October 3, 2026 11:28
@steipete
steipete merged commit 2288edb into main Oct 3, 2026
156 checks passed
@steipete
steipete deleted the steipete/cs-setup-retry-20261003 branch October 3, 2026 12:10
@steipete

steipete commented Oct 3, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 4, 2026
…er strand cloud workers (openclaw#164231)

* fix(crabbox): recover coordinator timeouts and reject unsupported backends

* fix(crabbox): retry node runtime preparation reads

Include ordinary runtime preparation in the existing fixed-lease coordinator retry policy. Extend the provider-flow regression and document the phase without changing timeouts, budgets, or allocation ownership.
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 merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: L status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant