Skip to content

fix: cancel cloud provisioning when stopping a worker - #133735

Merged
steipete merged 9 commits into
mainfrom
codex/cloud-provisioning-cancellation
Aug 31, 2026
Merged

steipete merged 9 commits into
mainfrom
codex/cloud-provisioning-cancellation

Conversation

@steipete

@steipete steipete commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

Current head: fadcbb2bd02ea4099f0cf1433a5e87b5d262bf40, based on 7f989bc446da6944530f8ac4edd8754f84f108e2. Final-head local gates, managed review, canonical package and hosted CI are complete. Fresh packaged authority and provider-cleanup proof passed on this exact revision. Native landing is being completed; this is not a claim that the PR is already merged.

Final-head live authority proof: create an empty managed session, save its dispatch request, canonically archive the exact session, then submit that saved request. The real Gateway returned INVALID_REQUEST: cannot dispatch an archived session; the entire provider-child trace and canonical placement/environment snapshot were unchanged. After canonical restore, that same session/profile made a real AWS allocation. One original Stop during a live setup child completed in 16.655 seconds. The recorded cancellation signal reached that child; its exit/close preceded the single provider Stop, whose successful exit/close preceded the original RPC response. A separate CLI inspection observed the exact lease released. The original dispatch settled as cancelled, placement returned to local, the environment was destroyed, and no claims/pending workspace/tool-authority rows remained. All eight observed original local process IDs/groups were absent after Gateway shutdown.

An exact-package restart retained that terminal state. Existing Control UI tabs reconnected with only startup/history/describe reads; there was no send, redispatch, reclaim or allocation. The sole provider child was a successful catalog read. Both restart observers drained and its three process IDs/groups were absent. Task Gateway, tunnel and temporary credentials were cleaned up; the operator Gateway and installed CLI were untouched. This proves archive-before-admission refusal and actual setup Stop, not revocation of an already-admitted callback across an await, default warm reuse, or a new native CUA run. Earlier 0ebd4731b366 CUA/WebVNC evidence below stays historical.

The fresh package passed every canonical phase, all 35,870 source inputs, installed graph/patch guards and unchanged UI size limit (346,591 bytes gzip below 347,353). Build ID: 2026.8.1-fadcbb2bd02e-2026-08-31T21-54-41.768Z; tar SHA256: 22b17a8da905eef3823482e36b22ece551d34c1fb78ebb5cb78e0e2e91bf0a0a. Final live receipt SHA256: 4739e8af3bb46a90484c00eb9b04d268e9c17a65c7ada595b84266085378389e. This is local package identity, not byte equality with a CI artifact.

Exact-head CI is successful: 186 successful checks and 16 skips, including the required gate. The first attempt failed an incoming-main oxlint process-group fixture from #134449. One unchanged retry of that job passed all 1,289 tests in the identical 55-file order on the same merge checkout 8c9278846bda025d9aac88f66c6c48431b2ecc9c (this head plus main 508858da1d9a1bc3482f6c9ea9a35c4c68e8c109). The underlying first process-state observation remains unresolved; the retry is not a root-cause repair, and total successful checks include retained prior successes. No timeout, environment or assertion changed.

The live proof helper initially expected the refusal on stderr. The canonical CLI returned the exact structured error on stdout with exit1; the parser was corrected to that source contract, with wrong-envelope controls. Original wire/response/no-I/O evidence was reused without replaying the refusal. No product code changed for this correction.

The incoming archive-reuse change (#134326) introduced a raw bundle-preparation wait outside the service lifetime. A new failing regression showed that Stop retained a paid warm-runtime lease while packaging was held. The repair removes that callback, prepares through the existing tracked producer/abortable consumer, and passes the resulting artifact into enrollment. A second executed failure caught an older packaging request revoking a newer enrollment. One shared phase check now runs before and after the asynchronous handoff, preserving the newer grant.

Both real service/enrollment/SQLite regressions now pass, followed by 421 tests across 18 suites, with one existing skip. All core/plugin production and test type checks, formatting and scoped lint pass. Two normal managed P0–P3 review passes found no actionable issue; all 35,870 source inputs and dependency guards match the committed bytes. This final repair is +7 net production lines, replacing the raw callback and duplicate bundle selection. No timeout or assertion was weakened.

The preceding main integration also passed 251 owner/recovery tests, 618 UI tests, 39 receipt-producer tests, and three shuffled six-file stress runs totaling 375 executions. Eight normal managed review passes were clean. Its CI found three fixture calls missing the new admission callback; the two fixture files were corrected and full core-test typing passed. Those results retain their original revision identities. The detailed 0ebd4731b366 package/native proof below remains historical, not final-head proof.

Related: #133551. This extends the landed lifecycle-ordering repair.

What Problem This Solves

Stopping a cloud session during acquisition, setup, enrollment or workspace preparation could leave the underlying operation running, block cleanup behind it, or reject Stop after the source had already returned to the Gateway. Active-worker teardown also inherited an inspection deadline too short for a managed lease release.

This repair makes cancellation and cleanup belong to the same admitted operation. A failed original Stop remains a failure even if background cleanup later succeeds.

Why This Change Was Made

Session admission and the placement coordinator now own dispatch, Move, recovery and reclaim ordering through one canonical operation set. Stop captures exact predecessor operations, starts canonical chat cancellation, and interrupts their admissions. Queued callers can stop waiting without releasing an active callback's ownership; active provider callbacks and final reconciliation remain joined until settlement. Each caller retains its own authorization, session incarnation, environment, generation and owner-epoch checks.

The attempt signal reaches project transfer, allocation, setup, runtime preparation, enrollment, bootstrap installation and startup synchronization. Shared immutable bootstrap artifacts distinguish an abortable consumer from the process-owned producer: stopping one enrollment does not delete another enrollment's artifact, and shutdown drains production and consumers before cleanup.

Move now records its already-completed local source result when cancellation interrupts an unpublished destination, but only for that exact cancellation reason and unchanged placement. It retires the exact Move intent. Replacement placements and independent failures still reject. Inventory and metadata commands share one settlement owner, which joins all writers and preserves independent failures. Real child interruption is recorded when the signal reaches a live command, so a prior nonzero exit or timeout is not rewritten as cancellation while a descendant holds stderr. Opening a missing input also closes the already-open output descriptor.

The provider's Stop helper owns its 310-second command budget. Destroy and failed provisioning reserve the existing child-settlement and diagnostic allowances separately. Only successful provider Stop releases allocation/image ownership; cancellation alone does not prove release. Inspection cadence and limits are unchanged.

Removed or absorbed paths include duplicate operation maps, reclaim-map polling, unconditional readiness waits, fixed pending-placement snapshots, Move-only completion handling, the sole-use destination wrapper, duplicate destination validation, and raw installer preparation bypass. The required rebase preserves main's shared setup helper, fewer readiness probes for trusted scripts, checkpoint-fork attestation, Daytona capture contract and filesystem-recorded bootstrap permissions. Arbitrary profile/desktop setup and native capture still refresh authoritative readiness.

No configuration option, environment variable, SQLite schema, dependency or public RPC shape is added. The provider SDK gains an optional attempt-cancellation signal. Providers that cannot interrupt are still joined until their callback settles.

User Impact

Stop cloud worker… interrupts supported provisioning after the requested/provisioning placement becomes visible. The initial prompt remains Not sent, with explicit Retry; it is not automatically resent. The RPC also covers earlier preparation without introducing an earlier UI button. Local reclaim, archive/delete eligibility, shared-host cleanup, shutdown adoption and active-worker teardown retain their existing contracts.

Evidence

Fully live-tested pre-rebase candidate: 0ebd4731b366bc38f3a83ac8064bd13583873e70, tree 9addbc2130ace3d9feeeee3f31882f0b4cbea701, based on ca0bdb8db3fe6defc861022e38452b515ea953bb. The final four-pass managed review, fresh canonical package and primary CI are green. Native CUA/WebVNC and Stop/restart verification passed at this exact0eb head; current rebased-head gates are described above. An earlier integration resolved four actual conflicts; the rebase leading to0eb resolved the single project-test conflict described below. The later bb6d type-union integration is recorded above. Both startup and cancellation test families were retained; main absorbed the independently fixed channel fixture, leaving no channel-test delta. CHANGELOG.md has no PR delta under the current release-only policy.

Prior f481 local Node24/macOS proof passed:

  • 94 tests across five files: actual Gateway/SQLite Move and Stop barriers, real inventory subprocesses, channel recovery and Gateway shutdown.
  • 502 tests across 35 owner/sibling files, with one existing Windows-only skip: bootstrap lifetime, node launch/admission, workspace transfer/reconciliation and worker-turn failures. This batch overlaps the 94-test inventory suite; counts are not summed as unique tests.
  • 426 Crabbox tests across 15 files, with one existing Linux-only process-identity skip: all four provisioning Stop phases, trusted setup without extra probes, AWS/Daytona project capture/reuse, fixed-lease cleanup and warm-image ownership.
  • Core/plugin production and test typing, scoped lint, canonical changed-doc checks, formatting and both affected MDX pages.

Three complete shuffled six-file stress runs passed with seeds17041/27059/37097: 360 passing executions (120 repeated under each seed), no failures or skips. Eight stress/docs guards verified all35,838 source inputs and the unchanged index. The normal managed P0–P3 review returned no actionable finding across eight passes. The fresh package passed all five canonical build/package phases, including UI size limits and actual source/tar identity checks. All source/index guards and original failures remain preserved; no timeout, isolation, size limit or authority assertion was weakened.

The repaired cases have executed pre-fix failures, including Move after source teardown, cancellation during destination preflight, independent inventory/metadata failure in either completion order, prior nonzero exit with inherited stderr held open, prior timeout and missing-input descriptor leakage. Cancellation-only, abort-induced exit, replacement-placement and session-incarnation controls remain covered.

Fresh 0eb integration proof passed 438 Crabbox tests across 16 files (one existing Linux-only skip), 113 Gateway/provider tests across eight files, core/plugin production and plugin test types, and formatting. The actual main conflict was only an adjacent project-test insertion; both independent test tables and their assertions are retained. Main’s checkpoint-wait behavior and maintenance lifecycle are included. The final tree matches the automatic merge except for that test-only resolution.

The pre-rebase0eb CI run completed successfully: 168 jobs passed, 16 skipped. Its actual checkout was merge 3f43d430115d91058f17df88d0a1e9bf482e6539, combining this head with main 0f0ae34d9a2b84cff53a4540ab50d3666e197b71. Both previous maintenance failures passed in the owning 471-file shard (6,358 tests passed, 59 skipped). The final normal managed P0–P3 review completed four clean passes.

The exact local package passed all five canonical phases and unchanged UI size limits. Its build ID is 2026.8.1-0ebd4731b366-2026-08-31T19-37-57.029Z, tar SHA256 96f259bdb7f1719142c52fb6378ad263fc842d3f81206262c7d2cb0f38d2a6be. Actual source, packaged UI and runtime dependency identity were independently verified; this is not a claim of byte equality with a CI artifact.

Integration regression and setup Stop verification

The f481 CI run exposed an interaction with the newer idle-image maintenance implementation. After the command runner settled an aborted deletion, the image retirement catch treated its cancellation as an ordinary deletion failure and resolved successfully. The repair revalidates the existing operation context at that catch boundary, preserving cancellation while normal deletion failures remain recorded for retry.

The exact CI merge d95e8cd7e348b06b405e58f91c708b6e7393fb7a reproduced both failures in the unchanged maintenance/plugin-service suites: 2 failed and 10 passed. The one-line owner fix made all 12 pass; another 365 tests across seven relevant suites passed on that merge. The same change passed 288 related tests on the PR branch. No test assertion, timeout, configuration or dependency changed; the existing main tests provide regression coverage.

On the packaged f481 build, actual UI Stop during cold node-enrollment setup completed in 14.359 seconds. The child required SIGTERM followed by the existing SIGKILL escalation; its close and the single successful provider Stop both preceded the original RPC success. Independent CLI inspection reported the lease released. Restart retained Not sent / Retry, local placement and no active run or resend. Both observer logs drained, and all 13 observed local process IDs/groups were absent. This cold-session proof does not cover warm-image deletion, the missed warmup window or a final successor's native CUA run.

The first fresh final-head startup failed before CUA at the coordinator run-registration boundary: its create request exceeded the existing deadline and the CLI correctly refused execution without a run handle. OpenClaw retained the initial message as Not sent / Retry, joined provider cleanup (220.508 seconds), and a separate inspection observed the lease released. This failed attempt remains recorded. One explicit UI Retry successfully provisioned a new worker for the final native proof; that later successful attempt and cleanup do not erase the original failure. The underlying request delay or response loss is not yet established, and no timeout or execution safeguard was weakened.

Final packaged native CUA, WebVNC and Stop

The final 0ebd4731b366 package passed through the real Control UI and native Codex 0.151.0 on the cloud worker. Exact build, normal worker user, runtime pointer, shared display and CUA artifact checks passed. The model used only the direct computer tool: one screenshot and three clicks using successive returned frames. Four actual model-facing images showed 0→1→2→3, matching independent RFB captures and the rendered WebVNC panel.

GUI Stop acknowledged an active native turn in 16 ms. Raw Codex TurnAborted, the computer close result/acknowledgement and persisted cancelled status were separately verified; the worker remained available. The first GUI attempt arrived after native completion and close, so its strict check failed and remains a missed-window attempt. It is not counted as a Stop pass.

A new native turn's original API reclaim succeeded in 20.420 seconds. The observer was freshly opened and had a130ms-old frame when reclaim was sent. The proof records native interruption/close, desktop-owner WebSocket closure1012, one successful provider Stop and its child close before the original reclaim response, then an independent inspection reporting the lease released. Strict checks passed again against the fully drained original logs.

The same-package Gateway restart retained cancelled/reclaimed state, a destroyed environment, no turn claim, pending workspace result, tool authority or session-tool operation, and no resend or new allocation. Its only provider child was a successful provider-catalog read. Actual UI showed no available desktop. Both Gateway processes and the approval observer ended; all39 observed local process IDs/groups were absent. These are scoped local/native/provider observations, not an atomic broker or universal remote-process proof.

Earlier live and Linux evidence — separate source identities

The preceding ed501 package ran through a fresh UI-created cloud session with native Codex 0.151.0 and CUA sharing the WebVNC desktop. The model took one screenshot and three clicks, each using its latest frame; four actual model-facing images and independently observed RFB/UI showed 0→1→2→3. GUI Stop acknowledged the active native run in 75 ms and retained the worker. A new run's original API reclaim succeeded in 53.023 seconds, with native abort/close acknowledgements, RFB owner closure code1012 and confirmed lease release. Strict saved-evidence/restart checks passed, and all 55 observed child PIDs/process groups were absent after Gateway shutdown. Separate setup Stop passed in 16.531 seconds. A warmup attempt and an earlier GUI attempt missed their required windows and remain misses, not Stop passes.

The ed501 CI run passed 168 jobs with 16 skips. The later fa4c64 package also passed all build/package guards, but was retained as pre-integration evidence after actual main conflicts were established. GitHub exposed the fa branch ref while PR metadata remained ed501; a bounded observation found no exact-fa CI run. Neither older CI nor older live proof is relabeled as f481 validation.

Earlier integrated Linux/Testbox proof passed all 15 phases, totaling 2,008 passing executions including repeated stress cases on exact commit6381cd4c. Earlier executed regressions and the unchanged phase order remain recorded. The d175 original active reclaim failed after 67.903 seconds when its provider child hit the old60-second deadline; later release does not repair that receipt. Subsequent b824 original reclaim passed in79.648 seconds, including provider Stop beyond the former deadline. These historical results explain the repair, not the final candidate's proof.

Companion dependency and remaining limits

Crabbox #1680 is merged. The last observed normal coordinator deployment includes that merge; GitHub workflow success alone is not a current serving-code attestation.

The live CLI dependency is the task-built Crabbox #1689 candidate e36e1cd4, which gives managed Stop a shared cancellation lifetime and makes daemon-lock waits cancellable. It remains open with green checks, auto-merge enabled and required independent approval unsatisfied. Inherited synchronous filesystem/process calls are not claimed to have a strict wall-clock bound. The operator's installed CLI and Gateway were not changed.

Fixed-checkpoint warm reuse additionally depends on draft Crabbox #1692, stacked on the unmerged parent. Retained pending capture additionally needs Crabbox #1698, currently unmerged; the tested e36 CLI accepts waiting but lacks that recovery path. Cold-session evidence does not prove default warm reuse, the earliest unresolved-allocation window, atomic broker observation, every viewer's closure or native Windows behavior.

Review disposition and scope

The latest completed ClawSweeper review, reviewed August 31 at 21:57 UTC on this exact head, identifies the missing final-effect authority proof as its security/evidence concern. The fresh archived-session refusal and allowed setup Stop trace above address that stated session-before-provider-I/O requirement. The independent runtime phase tests additionally prove an old packaging request cannot revoke newer enrollment, and cancellation still drains the producer. No runtime/code defect was identified by that review or the normal managed reviews.

Rank-up disposition: the optional broader unauthorized-principal/reassignment-during-await live matrix was not run. This proof deliberately uses the nearest revoked session admission and does not label it as caller-sharing revocation across an await. Existing real Gateway/SQLite caller-authority, replacement, lifecycle and post-await controls remain passing supplemental evidence. The external provider adoption/cleanup contract is confirmed below; the supported Crabbox boundary was exercised with real allocation, signal and settled cleanup. No server approval rule or required check is bypassed.

The optional provider-signal contract is additive: existing providers can omit or ignore it and remain joined until their callback settles. Crabbox composes attempt and narrower grant signals while cleanup keeps its separate lifetime. Paired-device and QA static SSH target existing shared hosts and retain callback settlement; no immediate-interruption promise is made for them. This contract is documented in the SDK overview. No SQLite schema/version or storage layout changes; the review's storage heuristic points to lifecycle consumers. No configuration option, environment variable, dependency or RPC shape is added.

Against pinned main 7f989bc, production is +1,498/-725 (net +773) across 39 files, tests/support +4,651/-462 (net +4,189) across 37, and docs +7/-1 (net +6) across two. Production growth supplies cancellation before placement exists and exact ownership through provider settlement/recovery. An environment-only guard misses pre-placement work; racing away an active child abandons cleanup. The change absorbs those responsibilities into existing admission, coordinator and provider owners, without a parallel cleanup service.

Named follow-ups: the incoming-main oxlint process-group observation in #134449 remains unclassified after its unchanged successful retry; UI elapsed timer #133545; the later forced-cleanup concurrent-Stop interval in paired-device Continue on Gateway abandonment; generic fixed-ID cancellation before broker admission. Main has since fixed the native PR wrapper import closure in #134366; that earlier tooling failure is no longer a pending source follow-up. A separate source-only follow-up on newer main is the optional non-admin background completion notice when observation precedes run registration; it is not reproduced here and does not change the ordinary cloud Stop/Retry owner. These are not claimed repaired here.

A view-only desktop source list briefly retained a stale attached entry after reclaim until refresh/restart; the actual desktop was unavailable and restart showed no sources. This is a named UI freshness follow-up, not evidence that the released worker remained usable.

@steipete
steipete requested a review from a team as a code owner August 31, 2026 02:37
@steipete steipete self-assigned this Aug 31, 2026
@clawsweeper

clawsweeper Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime extensions: crabbox size: XL maintainer Maintainer-authored PR labels Aug 31, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 31, 2026
@clawsweeper

clawsweeper Bot commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed August 31, 2026, 5:57 PM ET / 21:57 UTC.

ClawSweeper review

What this changes

The PR threads cancellation from stopping or reclaiming a cloud worker through session admission, provider provisioning, and lease cleanup.

Merge readiness

⛔ Blocked until real behavior proof is added - 5 items remain

Keep open for final-head authority-chain proof and maintainer review; the source repair is substantial and remains absent from fetched main, but the required provider-I/O rejection proof is not yet attached to the final revision.

Priority: P1
Reviewed head: fadcbb2bd02ea4099f0cf1433a5e87b5d262bf40

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The source repair and focused tests are substantial, but final-head authority-chain behavior remains unproven.
Proof confidence 🦪 silver shellfish (2/6) Needs real behavior proof before merge: Authority-chain proof required: available Stop evidence is tied to earlier revisions and does not show the final head rejecting the nearest stale or revoked authority before provider I/O. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🦐 gold shrimp (3/6) Security review found an item that needs attention.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: Authority-chain proof required: available Stop evidence is tied to earlier revisions and does not show the final head rejecting the nearest stale or revoked authority before provider I/O. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 7 items Introduced authority path: The final head passes the cancellation object into provider provisioning, checks it around provider work, and retains ownership until the provider operation settles.
Provider contract: The public worker-provider contract documents an optional provisioning signal and requires providers to settle active commands while independent cleanup proves release.
Exact cancellation owner: The cancellation owner records destroy intent only for the current provisioning operation and retains ownership while the provider invocation is still running.
Findings None None.
Security Needs attention Prove final-effect authority rejection: Cancellation and provider ownership cross session and cloud-provider boundaries; source checks are strong, but final-head evidence must show the nearest revoked or stale authority is rejected before an external provider effect.

How this fits together

Cloud-worker placement starts from a session dispatch, admits it against the current session lifecycle, provisions through the configured provider, and then attaches a worker. Stop or reclaim must cancel the admitted attempt while retaining provider cleanup ownership until a lease is proven released.

flowchart LR
  A[Session dispatch] --> B[Lifecycle admission]
  B --> C[Placement coordinator]
  C --> D[Worker provider provisioning]
  D --> E[Cloud lease and node enrollment]
  F[Stop cloud worker] --> B
  F --> G[Cancellation and reclaim]
  G --> D
  D --> H[Proven lease teardown]
Loading

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: Authority-chain proof required: available Stop evidence is tied to earlier revisions and does not show the final head rejecting the nearest stale or revoked authority before provider I/O. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Resolve security concern: Prove final-effect authority rejection - Cancellation and provider ownership cross session and cloud-provider boundaries; source checks are strong, but final-head evidence must show the nearest revoked or stale authority is rejected before an external provider effect.
  • Resolve merge risk (P1) - Final-head evidence does not yet show that the nearest stale or revoked session or placement is rejected before provider I/O while an allowed Stop still drains and releases the lease.
  • Resolve merge risk (P1) - The optional plugin-facing provisioning signal changes provider lifecycle expectations and needs final-head adoption and cleanup proof across the supported provider boundary.
  • Complete next step (P2) - A protected, authority-sensitive lifecycle repair needs final-head proof and maintainer review rather than automated repair dispatch.

Findings

  • [medium] Prove final-effect authority rejection — src/gateway/worker-environments/provider-lifecycle.ts:305
Agent review details

Security

Needs attention: The patch changes authority over provider allocation and teardown, but final-head proof has not shown stale or revoked authority failing before provider I/O.

PR surface

Source +781, Tests +4181, Docs +6. Total +4968 across 78 files.

View PR surface stats
Area Files Added Removed Net
Source 42 1541 760 +781
Tests 34 4608 427 +4181
Docs 2 7 1 +6
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 78 6156 1188 +4968

Review metrics

Metric Value Why it matters
Production versus test delta production +765; tests/support +3,999; docs +6 (PR-stated classification) The large lifecycle repair adds provider-boundary behavior as well as extensive cancellation coverage, so final-head behavioral proof is material before merge.

Stored data model

Persistent data-model change detected: durable storage schema: src/gateway/worker-environments/node-enrollment.ts, durable storage schema: src/gateway/worker-environments/node-worker-bundle-installer.ts, durable storage schema: src/gateway/worker-environments/placement-dispatch-coordinator.ts, durable storage schema: src/gateway/worker-environments/placement-dispatch-failure.ts, durable storage schema: src/gateway/worker-environments/placement-dispatch-startup.ts, durable storage schema: src/gateway/worker-environments/placement-dispatch-test-harness.ts, and 30 more. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Add final-head authority proof (recommended)
    Demonstrate on the final head that Stop drains an allocated provider operation and that the nearest stale or revoked session or placement cannot reach provider I/O.
  2. Explicitly accept the proof gap
    A maintainer may accept the remaining authority-boundary uncertainty only with an explicit review decision.

Technical review

Best possible solution:

Attach redacted final-head evidence covering an allowed Stop through proven cleanup and a stale or revoked authority rejected before provider I/O, then complete maintainer review of the provider contract.

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

No high-confidence current-main reproduction was run in this read-only review; the introduced source path and focused cancellation tests make the reported behavior source-reproducible.

Is this the best way to solve the issue?

Unclear: the canonical cancellation and retained-cleanup design is coherent in source, but final-head authority-boundary behavior has not been demonstrated in a real provider flow.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against d0c8f02d99b4.

Labels

Label justifications:

  • P1: Stopping a cloud worker can otherwise leave active cloud work or a paid lease running, affecting an active worker workflow.
  • merge-risk: 🚨 security-boundary: The patch changes cancellation authority across session and provider boundaries, but final-head proof of stale-authority rejection before I/O is missing.
  • merge-risk: 🚨 compatibility: The plugin-facing WorkerProvider provisioning contract gains cancellation and settlement obligations that supported providers must honor.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: Authority-chain proof required: available Stop evidence is tied to earlier revisions and does not show the final head rejecting the nearest stale or revoked authority before provider I/O. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

Security concerns:

  • [medium] Prove final-effect authority rejection — src/gateway/worker-environments/provider-lifecycle.ts:305
    Cancellation and provider ownership cross session and cloud-provider boundaries; source checks are strong, but final-head evidence must show the nearest revoked or stale authority is rejected before an external provider effect.
    Confidence: 0.86

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 final-effect proof for the nearest unauthorized principal and, because authority persists through provider settlement, prove revocation or reassignment invalidates it before I/O.

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 (19 earlier review cycles; latest 8 shown)
  • reviewed 2026-08-31T17:44:13.937Z sha ed50167 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-31T18:48:40.055Z sha f481ff4c07679e4dfa7ca2f0ddb8cf4565e56719 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-31T19:29:03.270Z sha 1dc1b5ace64f1eb073c1e78e78dc4f2aa0701c42 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-31T19:48:19.170Z sha 0ebd4731b366bc38f3a83ac8064bd13583873e70 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-31T20:11:29.453Z sha 0ebd4731b366bc38f3a83ac8064bd13583873e70 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-31T20:32:51.925Z sha 0ebd4731b366bc38f3a83ac8064bd13583873e70 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-31T21:06:39.108Z sha 69d3025d08906788c6343394f5361e5b2999c09f :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-31T21:27:10.582Z sha b1f5d86ca87ba1f2c8112924fde005f13b4b0522 :: needs real behavior proof before merge. :: none

@openclaw-barnacle openclaw-barnacle Bot reopened this Aug 31, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Aug 31, 2026
@openclaw-barnacle openclaw-barnacle Bot reopened this Aug 31, 2026
@steipete
steipete force-pushed the codex/cloud-provisioning-cancellation branch from 79a27cd to 32d42c1 Compare August 31, 2026 06:51
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

The updated head is 32d42c1a0d3ecc5fe32183b1abc2db943ae5da0b. It includes abortable queue readiness and the owner-boundary repairs described in the body. The newest fix preserves a later Stop’s newer recorded placement instead of replacing it with an older predecessor’s snapshot. Its failing reproduction, negative authority controls and 148 focused tests pass; the fresh two-pass managed review is clean. Broader tests, package/live proof and exact-head CI remain separate pending gates.

@clawsweeper

clawsweeper Bot commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 31, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 31, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Final head 0ebd4731b366bc38f3a83ac8064bd13583873e70 is ready for the native merge step. The repair keeps cancellation at admission/provider owners and waits for real child and cleanup settlement; it does not abandon work after a caller timeout.

The exact package passed native computer-only 0→1→2→3 with matching model images, RFB and WebVNC. GUI Stop acknowledged in16ms with separate native interruption/close proof. The original worker reclaim succeeded in20.420s after provider Stop settled; restart preserved cancellation/reclaim without resend or allocation. Independent strict replays passed. Original failed startup and the first completed-before-Stop attempt remain recorded in the body. Task leases/services and temporary auth inputs are cleaned; operator state was untouched.

Executed local commands:

node scripts/run-vitest.mjs extensions/crabbox
node scripts/run-vitest.mjs src/plugins/worker-provider-maintenance.test.ts src/gateway/worker-environments/service-lifetime.test.ts src/gateway/server-worker-environment-startup.test.ts src/gateway/server-worker-environment-startup.bootstrap.test.ts src/gateway/server-worker-environment-startup.lazy.test.ts src/gateway/worker-environments/inference.test.ts src/gateway/server-worker-placement-provision-cancellation.test.ts src/gateway/server-worker-placement-reclaim.preparation.test.ts
scripts/pr review-validate-artifacts 133735
OPENCLAW_TESTBOX=1 scripts/pr prepare-run 133735

These passed438 plugin tests (one existing platform skip),113 Gateway/provider tests, native artifact validation and hosted gates on the unchanged head. CI33431973610 passed168jobs/16skips; its actual merge is3f43d430. Four normal managed review passes found no actionable issue. The current ClawSweeper provider-ordering rank-up is addressed by this exact-head owner/live proof and documented optional-signal semantics. Classified production is+765net; tests/support+3999; docs+6, with the necessary ownership boundary explained in the body.

Default warm checkpoint reuse remains dependent on the separate Crabbox stack. This proof does not claim native Windows, atomic broker cleanup, universal viewer closure or a new production deployment. No review/CI server rule was bypassed.

@steipete
steipete force-pushed the codex/cloud-provisioning-cancellation branch 2 times, most recently from bb6df5b to 69d3025 Compare August 31, 2026 20:57
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 31, 2026
Admit dispatch and moves before the placement queue, cancel chat through
its canonical owner, and retain provider cleanup through real settlement.
Carry cancellation through project preparation, Crabbox commands and node
enrollment without canceling lease teardown.

Keep queued readiness abortable while preserving predecessor fences.
Track producer-reported placement transitions for captured dispatch, Move
and earlier Stop operations across lazy cancellation loading. Recognize
only exact successful completion and retain each caller's authorization.

Separate ordinary Stop ordering from pending cloud work eligibility.
Publish the synchronous Move begin before yielding and absorb new-intent
preparation into the Move service, removing the async store wrapper.

Select the newest recorded placement within the current session lifecycle
so an older Stop cannot override a later caller's valid initial snapshot.
Move dispatch admission contracts into the existing service contract and use
the canonical placement record to remove import cycles.

Update bootstrap preflight and late admission fixtures to observe the actual
owner lifetimes, and always settle held installation work before teardown.
Stop now accepts the exact settled local result when a Move is canceled before
its destination is published, while preserving replacement-session and placement
authority checks. Retire the exact move intent and inline the destination path.

Join workspace producers before cleanup, retain independent failures over abort,
and distinguish an interrupted command from an earlier exit or timeout while
its pipes drain. Close the output descriptor when opening an input fails.

Cover both handoff windows and error orderings, real subprocess exit/close
ordering, and descriptor cleanup. Repair nearby Gateway test type errors through
the real authored-config validator. Leave changelog generation to the release
workflow and retain the user-visible release context in the PR body.
Pass the coordinator admission callback in the recovery fixtures added on main. This preserves the existing recovery assertions while matching the cancellation coordinator contract.
@clawsweeper clawsweeper Bot added the merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. label Aug 31, 2026
@steipete
steipete force-pushed the codex/cloud-provisioning-cancellation branch from b1f5d86 to fadcbb2 Compare August 31, 2026 21:47
@steipete
steipete merged commit 5c388e5 into main Aug 31, 2026
464 of 466 checks passed
@steipete
steipete deleted the codex/cloud-provisioning-cancellation branch August 31, 2026 22:24
@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 1, 2026
* fix(gateway): cancel pending cloud worker provisioning

Admit dispatch and moves before the placement queue, cancel chat through
its canonical owner, and retain provider cleanup through real settlement.
Carry cancellation through project preparation, Crabbox commands and node
enrollment without canceling lease teardown.

Keep queued readiness abortable while preserving predecessor fences.
Track producer-reported placement transitions for captured dispatch, Move
and earlier Stop operations across lazy cancellation loading. Recognize
only exact successful completion and retain each caller's authorization.

Separate ordinary Stop ordering from pending cloud work eligibility.
Publish the synchronous Move begin before yielding and absorb new-intent
preparation into the Move service, removing the async store wrapper.

Select the newest recorded placement within the current session lifecycle
so an older Stop cannot override a later caller's valid initial snapshot.

* fix(workers): retain cancellation ownership through provisioning

* fix: align worker cancellation contracts and fixtures

Move dispatch admission contracts into the existing service contract and use
the canonical placement record to remove import cycles.

Update bootstrap preflight and late admission fixtures to observe the actual
owner lifetimes, and always settle held installation work before teardown.

* fix: give cloud lease cleanup its own command budget

* test(crabbox): align lifecycle assertions with managed stop budget

* fix(cloud): preserve canceled move completion and command failures

Stop now accepts the exact settled local result when a Move is canceled before
its destination is published, while preserving replacement-session and placement
authority checks. Retire the exact move intent and inline the destination path.

Join workspace producers before cleanup, retain independent failures over abort,
and distinguish an interrupted command from an earlier exit or timeout while
its pipes drain. Close the output descriptor when opening an input fails.

Cover both handoff windows and error orderings, real subprocess exit/close
ordering, and descriptor cleanup. Repair nearby Gateway test type errors through
the real authored-config validator. Leave changelog generation to the release
workflow and retain the user-visible release context in the PR body.

* fix(crabbox): propagate cancellation during image retirement

* test(workers): admit targeted recovery fixtures

Pass the coordinator admission callback in the recovery fixtures added on main. This preserves the existing recovery assertions while matching the cancellation coordinator contract.

* fix(cloud): retain shared archive preparation 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 maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: XL status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant