Repository navigation
feat(gateway): durable cloud worker environments, provider SDK contract, and lifecycle RPCs - #104401
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f0c772f74e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const hasWorkerEnvironmentRecords = (workerEnvironmentStore?.list().length ?? 0) > 0; | ||
| // Durable rows can outlive profiles. Startup planning still enforces plugin trust/disable gates. | ||
| const listDurableWorkerProviderIds = () => | ||
| uniqueStrings( | ||
| workerEnvironmentStore?.listForReconcile().map((record) => record.providerId) ?? [], |
There was a problem hiding this comment.
Guard worker store reads during startup
When a persisted worker row is corrupt or incompatible, store.list()/listForReconcile() throw while decoding rows, but these startup probes run before the gateway binds and outside the environments.list/status damage-handling path. In that case a bad worker table prevents even the existing gateway/node inventory from starting, so these probes should catch worker-store failures and treat them as no durable providers (or otherwise degrade) until the RPC handler can report worker status safely.
Useful? React with 👍 / 👎.
f0c772f to
57e7e72
Compare
|
Codex review: needs real behavior proof before merge. Reviewed July 11, 2026, 7:47 AM ET / 11:47 UTC. Summary Reproducibility: yes. for both patch defects from source. A malformed persisted worker row reaches strict pre-bind decoding and can abort gateway startup; a provider profile with a plaintext credential under an unrecognized name such as credential or accessKey passes the generic validator and is copied into the durable snapshot. The cloud-worker capability itself is a new feature, not a current-main bug. Review metrics: 4 noteworthy metrics.
Stored data model Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Copy recommended automerge instructionNext step before merge
Maintainer decision needed
Security Review findings
Review detailsBest possible solution: Before merge, make provider secret declarations explicit and schema-backed rather than relying on an incomplete key-name guess, isolate every pre-bind worker-store probe so corrupt rows cannot prevent gateway service, retain the generic plugin-owned provider and canonical SQLite boundaries, and add redacted live provision/restart-adoption/list-status/destroy evidence. Do we have a high-confidence way to reproduce the issue? Yes for both patch defects from source. A malformed persisted worker row reaches strict pre-bind decoding and can abort gateway startup; a provider profile with a plaintext credential under an unrecognized name such as credential or accessKey passes the generic validator and is copied into the durable snapshot. The cloud-worker capability itself is a new feature, not a current-main bug. Is this the best way to solve the issue? No in its current form. The plugin-owned provider seam and SQLite lifecycle owner are the right architectural direction, but failure isolation and an explicit, complete secret contract are necessary before publishing these permanent surfaces. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 651aab87f3ee. Label changesLabel justifications:
Evidence reviewedSecurity concerns:
Acceptance criteria:
What I checked:
Likely related people:
What the crustacean ranks mean
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. How this review workflow works
Review history (3 earlier review cycles)
|
|
Merged via squash.
|
…ct, and lifecycle RPCs (openclaw#104401) * docs(plan): add cloud workers design plan * feat(plugin-sdk): add cloud worker provider foundations * feat(protocol): add worker environment lifecycle shapes * feat(gateway): persist worker environment lifecycles * test(gateway): pin environment inventory assertion for damaged worker store * style(cloud-workers): satisfy lint and docs formatting * fix(gateway): narrow worker environment type boundaries * chore(plugin-sdk): account for WorkerProvider surface growth * docs: regenerate docs map
Part of #104294 (cloud workers, milestone 1, PR 1 of the series). Design:
docs/plan/cloud-workers.md(included in this PR).What Problem This Solves
Cloud workers need a durable, crash-safe foundation before any remote execution exists: a persistent environment lifecycle (so provisioned machines are never leaked or double-provisioned across gateway restarts) and a provider seam so lease backends live in plugins, not core.
Why This Change Was Made
First PR of the cloud-workers series. It adds only the durable substrate — no worker runtime, no tunnel, no session integration yet:
requested -> provisioning -> bootstrapping -> ready -> (attached|idle) -> draining -> destroying -> destroyed | failed | orphaned.inspectagainst local records.WorkerProvidercontract in the plugin SDK (provision/inspect/renew?/destroy), registered via manifestcontracts.workerProviders; provider ids normalized and deterministically ordered. SSH key material is referenced only throughSecretRef(validated recursively for any sensitive-looking key in provider settings).environments.create({ profileId, idempotencyKey }, idempotent replay) andenvironments.destroy;environments.list/statusgainworkermetadata. No protocol version bump. Existing gateway/node projection unchanged; a damaged worker store never regresses it.static-sshdev-only provider in the QA Lab plugin (source-only, excluded from packaged distributions, documented warning).cloudWorkers.profilesconfig block; the RPC descriptors are not even registered when unconfigured and no durable rows exist.User Impact
None until configured: clean installs see no new RPCs, no new behavior. Operators who opt in get durable environment records and provisioning/teardown RPCs that later PRs (bootstrap, tunnel, worker protocol) build on. Config reference and protocol docs updated.
Evidence
tbx_01kx8b638vc2zce843jja2dbpp: PR test suite green — 5 Vitest shards, 154 tests passed (worker-environments state/store/service, environments RPC handlers, provider registry, cloud-workers config schema, static-ssh provider, plugin auto-enable, protocol schema).check:changedlanes on the same box: all lanes green except the npm shrinkwrap guard, which fails identically for 13 packages this PR does not touch (root,extensions/feishu,extensions/slack, ... with npmEOVERRIDEon@smithy/node-http-handler) — inherited from currentorigin/maindependency churn, no dependency-bearing file is in this diff.