Skip to content

refactor(workers): make worker turns node-only - #125384

Merged
steipete merged 10 commits into
mainfrom
steipete/delete-cloud-ssh-carrier
Aug 17, 2026
Merged

steipete merged 10 commits into
mainfrom
steipete/delete-cloud-ssh-carrier

Conversation

@steipete

@steipete steipete commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

After cloud worker turns converged onto node transport, the worker-provider contract could still advertise both execution modes and return an SSH lease for worker-turn. That kept the replaced reverse-worker carrier reachable through provider configuration, while Crabbox still parsed and exposed SSH identity fields that its node leases no longer use.

Why This Change Was Made

This makes each session-placement provider choose one current transport mode, encodes that declaration as a one-element SDK tuple, and validates both new and persisted leases at the lifecycle owner: worker-turn requires a node lease, and remote-exec requires an SSH lease. A mismatched lease is durably recorded, destroyed, and terminalized instead of being bootstrapped through the wrong carrier, including after Gateway restart. QA Lab static SSH is now remote-exec only, while Crabbox deletes its obsolete SSH identity resolver and inspect projection.

The generic pinned SSH workspace/sandbox contract remains intact for Codex-style remote-exec; this slice deliberately does not remove rsync or the independent SSH sandbox. The lifecycle options type moved to a concept-named module to keep the owner below the repository line limit without adding a suppression.

AI-assisted; the implementation and boundary analysis were reviewed with the repository autoreview gate.

User Impact

Supported cloud behavior is unchanged: Crabbox worker turns stay node-backed, and SSH remote execution stays available through an explicitly remote-exec provider. Persisted leases whose stored transport no longer matches their provider declaration are reclaimed as failed during restart reconciliation instead of reviving an obsolete execution path. The existing ordered-fallback integration fixture now declares remote-exec, matching its SSH lease while preserving its bootstrap, restart, workspace, reclaim, and teardown assertions. Pre-release provider plugins that return a lease for the wrong transport now fail before session use and clean up their allocation. Operator documentation no longer describes Crabbox as an OpenClaw SSH lease or identity provider.

Evidence

  • The fresh-allocation regression failed on pre-fix code in both directions: an SSH lease reached ready for worker-turn, while a node lease for remote-exec failed later as a generic bootstrap error.
  • The persisted-lease regression also failed pre-fix: restart reconciliation inspected and resumed a stored SSH lease after its provider became worker-turn-only instead of destroying it.
  • node scripts/run-vitest.mjs src/agents/bash-tools.test.ts src/gateway/worker-environments/environment-access.test.ts src/gateway/server.sessions.worker-original-order.test.ts src/gateway/worker-environments/provider-bootstrap.test.ts src/gateway/worker-environments/provider-provisioning-node-admission.test.ts src/gateway/worker-environments/provider-provisioning-node.test.ts src/gateway/worker-environments/provider-provisioning.test.ts src/gateway/worker-environments/provider-reconciliation.test.ts src/plugins/worker-provider-registry.test.ts extensions/qa-lab/src/static-ssh-worker-provider.test.ts extensions/crabbox/src/crabbox-worker-inspect.test.ts extensions/crabbox/src/crabbox-worker-provider.test.ts — 235 tests passed on the exact rebased head.
  • CI exposed an unrelated flaky bash-tools assertion that matched events by the first eight characters of a human-readable process slug. The test now uses the exact exec:<sessionId> event contextKey, matching production receipt ownership; three additional focused runs passed.
  • node scripts/check-changed.mjs — passed.
  • pnpm build — passed.
  • pnpm plugin-sdk:surface:check — passed.
  • autoreview --mode branch --base origin/main — clean.
  • Production/test/docs LOC: production +205/-205 (net 0), tests +148/-123 (net +25), docs +12/-15 (net -3). Production stays net-neutral while the regression coverage grows.
  • Upgrade audit: WorkerProvider was introduced after stable tag v2026.7.1-2; no stable release tag contains that Plugin SDK surface. The repository's beta-only SDK policy therefore permits the current-only single-mode contract without a deprecation shim.
  • Direct Codex source inspection confirmed environment/add registers a stable exec-server URL and preserves the separate remote-exec environment lifecycle; this change keeps that SSH workspace contract and removes only SSH-backed worker-turn eligibility.

@clawsweeper

clawsweeper Bot commented Aug 17, 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: qa-lab extensions: crabbox size: L maintainer Maintainer-authored PR labels Aug 17, 2026
@steipete
steipete marked this pull request as ready for review August 17, 2026 19:58
@steipete steipete self-assigned this Aug 17, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 17, 2026
@clawsweeper

clawsweeper Bot commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 17, 2026, 6:43 PM ET / 22:43 UTC.

ClawSweeper review

What this changes

The PR makes worker-placement providers declare one transport mode, rejects incompatible SSH/node leases during provisioning and restart reconciliation, and removes obsolete Crabbox SSH handling.

Regression provenance

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

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

Keep open for maintainer compatibility review. No concrete patch defect was found, but the checked-out head has no merge-base with the supplied base and the required Codex source checkout is unavailable, so the preview-SDK and Codex-contract claims cannot be independently confirmed here.

Priority: P2
Reviewed head: 65272f8b3a1d1c5a22a3c0279d946e1ba63dc6b6
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The implementation and focused regression coverage are coherent, with remaining merge confidence depending on maintainer verification of compatibility provenance.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored PR is not subject to the external-contributor real-behavior-proof gate; focused test evidence is supplied, while direct Codex provenance remains a maintainer review gap.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored PR is not subject to the external-contributor real-behavior-proof gate; focused test evidence is supplied, while direct Codex provenance remains a maintainer review gap.
Evidence reviewed 6 items Current-main behavior: Current main still exposes an array of supported execution modes, allowing a provider to advertise both transports.
Fresh-lease owner boundary: The branch validates a returned lease against the provider's sole declared mode before choosing node provisioning or SSH bootstrap.
Persisted-lease owner boundary: Reconciliation fences a stored lease whose durable node/SSH transport conflicts with the current provider declaration before provider inspection.
Findings None None.
Security None None.

How this fits together

Cloud worker placement records a provider lease, then Gateway runs it either as a node-backed worker turn or an SSH-backed remote-exec environment. The PR enforces that provider declarations and durable lease transport agree before the lifecycle can resume work.

flowchart LR
A[Session placement] --> B[Worker provider]
B --> C[Declared transport]
C --> D[Lease validation]
D --> E[Gateway lifecycle]
E --> F[Node worker turn]
E --> G[SSH remote execution]
Loading

Decision needed

Question Recommendation
Should OpenClaw intentionally reject existing preview worker providers that advertise both transports, after confirming the current Codex remote-exec contract remains covered? Confirm the current-only contract: Verify that WorkerProvider was never stable and that Codex remote-exec remains SSH-backed, then accept the single-mode SDK boundary.

Why: This is a protected maintainer PR that narrows a plugin SDK contract, while release and direct Codex provenance are unavailable in this review environment.

Before merge

  • Resolve merge risk (P1) - Merging deliberately rejects preview providers that still advertise both execution modes; the supplied checkout could not independently verify the claim that no stable release contains this SDK surface.
  • Resolve merge risk (P1) - The PR's Codex remote-exec compatibility claim cannot be checked because the required Codex source files are absent from the available sibling checkout.
Agent review details

Security

None.

PR surface

Source 0, Tests +25, Docs -3. Total +22 across 27 files.

View PR surface stats
Area Files Added Removed Net
Source 11 206 206 0
Tests 12 147 122 +25
Docs 4 12 15 -3
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 27 365 343 +22

Review metrics

Metric Value Why it matters
Production versus test LOC production +205/-205 (net 0); tests +148/-123 (net +25) The PR body reports net-neutral production changes while adding lifecycle regression coverage; the local checkout cannot independently compute the PR range because the supplied base has no merge-base with head.

Stored data model

Persistent data-model change detected: durable storage schema: src/gateway/worker-environments/provider-lifecycle.ts, durable storage schema: src/gateway/worker-environments/provider-lifecycle.types.ts, durable storage schema: src/gateway/worker-environments/provider-persisted-lease.ts, durable storage schema: src/gateway/worker-environments/provider-provisioning.test.ts, durable storage schema: src/gateway/worker-environments/provider-reconciliation.test.ts, durable storage schema: src/gateway/worker-environments/service-validation.ts, and 8 more. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Verify and accept the preview break (recommended)
    Confirm the SDK was not shipped in a stable tag and the retained SSH remote-exec path matches current Codex behavior before merging.
  2. Pause for contract provenance
    Do not merge until a complete checkout can verify the release boundary and direct Codex protocol source.

Technical review

Best possible solution:

Keep the single-transport lease invariant, but merge only after an owner verifies the preview-only compatibility decision and the current Codex remote-exec contract.

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

No live reproduction was run in this read-only review, but the fresh and persisted mismatch paths are directly traceable in source and covered by focused regression tests.

Is this the best way to solve the issue?

Yes for the lifecycle boundary: validation occurs where leases enter and resume, rather than at downstream SSH/node consumers; the compatibility decision still needs owner confirmation.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This is a bounded worker-provider and Gateway lifecycle compatibility change rather than an active core-runtime outage.
  • merge-risk: 🚨 compatibility: The PR narrows the WorkerProvider SDK declaration and causes previously accepted dual-mode preview providers to fail registration.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored PR is not subject to the external-contributor real-behavior-proof gate; focused test evidence is supplied, while direct Codex provenance remains a maintainer review gap.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Recent history attributes the node-transport convergence and this branch's lifecycle changes to this contributor. (role: recent area contributor; confidence: high; commits: 45e6784338ad, 65272f8b3a1d; files: src/gateway/worker-environments/provider-lifecycle.ts, extensions/crabbox/src/crabbox-worker-provider.ts, src/plugins/capability-provider.types.ts)

Rank-up moves

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

  • Verify the stable-release SDK boundary and direct Codex remote-exec source before merge.

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 (9 earlier review cycles; latest 8 shown)
  • reviewed 2026-08-17T20:27:19.287Z sha 4ff3e9c :: needs maintainer review before merge. :: none
  • reviewed 2026-08-17T20:35:49.844Z sha 4ff3e9c :: found issues before merge. :: [P2] Narrow the public placement-mode type
  • reviewed 2026-08-17T21:09:15.943Z sha b280450f793ed5fe0e84f1decabf12f572d8798d :: found issues before merge. :: [P1] Validate persisted leases during reconciliation
  • reviewed 2026-08-17T21:16:01.091Z sha b280450f793ed5fe0e84f1decabf12f572d8798d :: found issues before merge. :: [P1] Validate persisted leases during reconciliation
  • reviewed 2026-08-17T21:39:43.014Z sha 5b012839b9441dafe23e8235474d82d170c6c5bf :: needs maintainer review before merge. :: none
  • reviewed 2026-08-17T21:45:58.517Z sha 5b012839b9441dafe23e8235474d82d170c6c5bf :: needs maintainer review before merge. :: none
  • reviewed 2026-08-17T22:25:41.321Z sha 42dfe9c84653fc34c2d3b9684fcf49f802b54436 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-17T22:34:34.150Z sha 65272f8 :: needs maintainer review before merge. :: none

@steipete
steipete force-pushed the steipete/delete-cloud-ssh-carrier branch from 2251d0a to 4ff3e9c Compare August 17, 2026 20:20
@clawsweeper clawsweeper Bot added 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. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 17, 2026
@steipete

steipete commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor Author

ClawSweeper findings addressed through 65272f8b3a1:

  • [P1] Align the original-order fixture with its SSH transport — fixed. The integration provider and its dispatch now both declare remote-exec, matching the SSH lease while preserving the complete fallback-port, bootstrap, Gateway-restart, workspace-transfer, reclaim, provider-destroy, and session-retirement ordering assertions.
  • [P2] Narrow the public placement-mode type — fixed. supportedExecutionModes is now a one-element readonly tuple, so TypeScript plugin authors cannot compile the multi-mode declaration that registration rejects. The generic service fixture defaults to remote-exec, and every node-returning fixture now declares worker-turn explicitly.
  • [P1] Validate persisted leases during reconciliation — fixed. Restart reconciliation derives the stored SSH/node transport before provider inspection. If it conflicts with the provider's current declaration, the Gateway records the invalid-profile reason and uses the existing durable destroy path; it never inspects, bootstraps, or resumes the stale carrier. The regression failed pre-fix because provider inspection ran once, then passed after the fence.
  • Multi-mode provider compatibility — intentionally current-only. WorkerProvider was introduced after stable tag v2026.7.1-2; no stable release tag contains that Plugin SDK surface. Under OpenClaw's beta-only SDK policy, existing preview providers must choose their actual current transport mode rather than retain a permissive dual-mode shim that keeps SSH-backed worker turns reachable.
  • Codex contract proof — inspected directly. codex-rs/app-server-protocol/src/protocol/v2/environment.rs:10-16 defines environment/add as a stable environment id plus exec-server URL; codex-rs/app-server/src/request_processors/environment_processor.rs:16-27 upserts that environment in the app-server manager; and codex-rs/app-server/tests/suite/v2/environment_add.rs:66-199 proves selected-thread connection and disconnection notifications. This PR retains the SSH remote-exec workspace/exec-server path and removes only SSH-backed worker-turn eligibility.

Focused proof:

  • node scripts/run-vitest.mjs src/gateway/server.sessions.worker-original-order.test.ts src/gateway/worker-environments/provider-bootstrap.test.ts src/gateway/worker-environments/provider-provisioning-node-admission.test.ts src/gateway/worker-environments/provider-provisioning-node.test.ts src/gateway/worker-environments/provider-provisioning.test.ts src/gateway/worker-environments/provider-reconciliation.test.ts src/plugins/worker-provider-registry.test.ts extensions/qa-lab/src/static-ssh-worker-provider.test.ts extensions/crabbox/src/crabbox-worker-inspect.test.ts extensions/crabbox/src/crabbox-worker-provider.test.ts — 235 tests passed on the rebased exact head, including the previously failing node-access and bash-tools CI files.
  • The unrelated bash-tools CI flake matched human-readable process slugs by an ambiguous 8-character prefix; assertions now use the exact exec:<sessionId> event context key, and three additional focused runs passed.
  • pnpm plugin-sdk:surface:check — passed.
  • pnpm build — passed.
  • node scripts/check-changed.mjs — passed.
  • autoreview --mode branch --base origin/main — clean.
  • The PR body contains the final runtime, restart, SDK, LOC, compatibility, and direct dependency evidence.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 17, 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 P2 Normal backlog priority with limited blast radius. 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. and removed 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 Aug 17, 2026
@clawsweeper

clawsweeper Bot commented Aug 17, 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:

@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 17, 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: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 17, 2026
@steipete
steipete force-pushed the steipete/delete-cloud-ssh-carrier branch from 5b01283 to 42dfe9c Compare August 17, 2026 21:58
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper

clawsweeper Bot commented Aug 17, 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.

@steipete
steipete force-pushed the steipete/delete-cloud-ssh-carrier branch from 42dfe9c to 65272f8 Compare August 17, 2026 22:26
@openclaw-barnacle openclaw-barnacle Bot added the agents Agent runtime and tooling label Aug 17, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 17, 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.

@clawsweeper

clawsweeper Bot commented Aug 17, 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.

@clawsweeper

clawsweeper Bot commented Aug 17, 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:

@steipete
steipete merged commit 2fc85bd into main Aug 17, 2026
225 checks passed
@steipete
steipete deleted the steipete/delete-cloud-ssh-carrier branch August 17, 2026 22:47
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 18, 2026
* refactor(workers): bind placement modes to transports

* refactor(workers): split provider reconciliation

* Revert "refactor(workers): split provider reconciliation"

This reverts commit 0a1f97399b23eca81e99af45dd9ea616e266de54.

* refactor(workers): split lifecycle options

* test(workers): align SSH fixture with remote exec

* refactor(workers): encode one placement mode

* fix(workers): fence persisted transport mismatches

* style(workers): keep persisted lease note concise

* test(workers): declare node access fixture modes

* test(agents): match exec notifications by receipt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation extensions: crabbox extensions: qa-lab gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L 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