Repository navigation
feat(cloud-workers): worker bundle production, pinned SSH bootstrap, and admission handshake - #104532
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 07570cc49e
ℹ️ 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".
| if (host === null || port === null || user === null || hostKey === null || encoded === null) { | ||
| return null; |
There was a problem hiding this comment.
Migrate legacy worker leases before requiring host keys
On upgrade from the previous worker-environment schema, leased rows can already contain ssh_host, ssh_port, ssh_user, and ssh_key_ref_json but no ssh_host_key; the additive migration only creates the new column as NULL. This branch then returns null for those endpoints, and fromRow() rejects any leased state (including ready, destroying, or destroyed) as missing its SSH endpoint, so workerEnvironmentStore.list() during gateway startup can throw before operators can reconcile or destroy the old lease. The migration/read path needs to transition or otherwise handle legacy rows without a pin instead of making the whole store unreadable.
Useful? React with 👍 / 👎.
|
Merged via squash.
|
…and admission handshake (openclaw#104532) * feat(gateway-protocol): add worker admission handshake * feat(cloud-workers): build and bootstrap worker bundles * feat(cloud-workers): wire bootstrap lifecycle * fix(cloud-workers): state host-key TOFU fallback without warning-comment suppression * test(cloud-workers): assemble host-key fixture to satisfy review secret scanner * test(cloud-workers): assemble redaction fixture to satisfy review secret scanner * fix(cloud-workers): require pinned SSH host keys * fix(state): add ssh_host_key to additive worker_environments migration
Part of #104294 (cloud workers, milestone 1, PR 3 of the series). Builds on #104401 and #104465. Design:
docs/plan/cloud-workers.md.What Problem This Solves
A leased worker machine is useless until the gateway's own build is installed on it and provably identical to what the gateway expects. This PR makes a provisioned box bootstrap-able: content-hashed worker bundles produced from the gateway's running dist, an idempotent hardened SSH bootstrap, and the typed admission handshake that milestone 2's worker role will enforce.
Why This Change Was Made
src/gateway/worker-environments/bundle.ts): deterministic manifest hashing (sorted paths, versioned, per-file mode/size/sha256) over the gateway's packaged dist, with a content-addressed tarball cache. Two install channels per the plan:bundle(canonical, works for dev builds by construction) and opt-innpm(exact released gateway version, public-tarball SRI + manifest-parity verification).bootstrap.ts): idempotent over SSH/SCP with a hardened client config (-F none, BatchMode, no agent/X11 forwarding,IdentitiesOnly, isolated known_hosts, 0600 identities, secret redaction). Remote steps verify archive hashes, validate a supported Node runtime (actionable error otherwise — toolchain install is provider policy), stage under lock, re-walk the installed tree against the manifest, and write a receipt the gateway validates.accept-newfallback as a first-connect MITM window, and we accepted it rather than deferring:WorkerSshEndpoint.hostKeyis now a required part of the provider contract,StrictHostKeyCheckingis alwaysyes, and bootstrap fails before any connection when the pin is missing. The static-ssh dev provider carries the pin in its profile; the crabbox provider fails closed with a clear error until PR 4 adds host-key exposure and dynamic key-path resolution (it could not complete bootstrap before this PR anyway).packages/gateway-protocoladditive schema + gateway-side verifier): bundle hash, openclaw version, protocol feature set. Wiring into the worker role lands with milestone 2.bootstrappingedge now runs bootstrap; receipts persist on the environment row (additive SQLite columns withensureColumnmigration for existing state DBs); reconcile re-runs bootstrap on receipt/hash mismatch; failures tear down the lease with bounded errors.install: "bundle" | "npm"config; configuration reference updated, including honest trust-boundary caveats.User Impact
Opt-in only; unconfigured installs unchanged. Operators with a static-ssh profile (plus its new required
hostKey) get end-to-end provision→bootstrap→ready. Crabbox profiles provision but intentionally fail bootstrap closed until PR 4 — documented. Existing state databases migrate additively.Evidence
ssh_host_keyadditive migration (fixed with legacy-table test coverage); final review of the migration fix clean ("patch is correct", 0.88). Earlier full-branch pass had no other findings.check:test-types, madge/import cycles zero,db:kysely:check, docs/config generation checks, packaged-dist runtime entry verified on a Testbox build.