Repository navigation
feat(cloud-workers): pinned SSH tunnel runtime and provider-owned key resolution - #104553
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d73a128082
ℹ️ 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".
| ageMs: Type.Integer({ minimum: 0 }), | ||
| idleMs: Type.Optional(Type.Integer({ minimum: 0 })), | ||
| attachedSessionIds: Type.Array(NonEmptyString), | ||
| tunnelStatus: WorkerTunnelStatusSchema, |
There was a problem hiding this comment.
Keep tunnelStatus backward-compatible
When a newer client talks to an older gateway that still negotiates protocol v4 (the generated native constants remain at version 4), older worker summaries do not include worker.tunnelStatus; making this field required here also makes the SDK and Swift WorkerEnvironmentMetadata require it, so environments.list/status/create/destroy responses containing a worker from an older v4 gateway can fail validation or decoding. For this protocol-4 additive field, make it optional/default to stopped on clients or version-gate it before requiring it.
Useful? React with 👍 / 👎.
|
Codex review: needs real behavior proof before merge. Reviewed July 11, 2026, 12:23 PM ET / 16:23 UTC. Summary PR surface: Source +915, Tests +704, Docs +4, Generated 0, Other +11. Total +1634 across 37 files. Reproducibility: not applicable. This PR implements a staged new capability rather than fixing broken established behavior; the relevant validation path is a real SSH worker scenario. Review metrics: 2 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:
Next step before merge
Maintainer decision needed
Security Review detailsBest possible solution: Keep the pinned, gateway-owned tunnel and provider-owned identity design, but require a redacted live static-SSH run covering initial connection, forced reconnect, a separate workspace command, epoch-safe stop, and remote socket cleanup; also link the exact Crabbox host-key companion before merge. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR implements a staged new capability rather than fixing broken established behavior; the relevant validation path is a real SSH worker scenario. Is this the best way to solve the issue? Yes, conditionally: the gateway-owned pinned reverse tunnel and provider-owned opaque identity resolver are the narrowest design-consistent solution, and no duplicate supported path exists, but live proof and an explicit staging decision are still required. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against b769964e82ab. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +915, Tests +704, Docs +4, Generated 0, Other +11. Total +1634 across 37 files. View PR surface stats
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
|
|
Merged via squash.
|
… resolution (openclaw#104553) * feat(cloud-workers): add pinned SSH tunnel runtime * feat(crabbox): resolve cloud worker SSH identities * docs(cloud-workers): document SSH tunnel contracts
Part of #104294 (cloud workers, milestone 1, PR 4 — final PR of the milestone). Builds on #104401, #104465, #104532. Design:
docs/plan/cloud-workers.md.What Problem This Solves
A bootstrapped worker still has no communication path: the design routes everything (worker protocol, transcript ingestion, inference proxy) over a gateway-initiated SSH reverse tunnel, so the box needs zero network reachability in either direction beyond its sshd. This PR adds that tunnel runtime, plus the two provider key contracts PR 3 left fail-closed.
Why This Change Was Made
src/gateway/worker-environments/tunnel.ts): gateway-initiated reverse tunnel forwarding a worker-local unix socket (randomized 0700 directory, 0177 umask — no port collisions, multi-user isolation) to the gateway's WS endpoint. Keepalives (ServerAlive), capped reconnect backoff, owner-epoch fencing (a reconnect cannot resurrect a tunnel for a drained/replaced environment — new epoch publishes before old teardown awaits, every await re-checks currency), clean teardown, and a separate SSH connection for workspace transfer so rsync cannot head-of-line-block control traffic. Socket cleanup ownership was decided against OpenSSH source behavior (OpenSSH unlinks before listener bind; channel teardown does not unlink), so the manager owns cleanup and never unlinks a replacement's socket.ssh.ts— bootstrap, tunnel, and workspace paths share the pinned trust material and option set instead of duplicating it. No connection multiplexing; pinning always strict.inspect --jsoncannot expose host-key material today (StatusView carries host/user/port/client-key path only; existing trust is TOFU in its own ssh path; workspace provisioning already generates host keys). OpenClaw now consumes the designed optionalsshHostKeyfield ("algorithm base64", authoritative pre-first-boot key) when present and remains fail-closed when absent. The required crabbox-side plumbing is specified precisely in this PR's review notes and tracked as a companion change in the crabbox repo.environments.list/statussummaries; no SQLite persistence because connection state is process-owned and ephemeral (lifecycle-owned, per the freshness rules).User Impact
Opt-in only. Static-ssh environments gain a working, pinned, self-healing tunnel runtime with start/stop APIs (consumed by the milestone-2 worker role). Crabbox environments remain fail-closed on bootstrap until the crabbox CLI ships
sshHostKey. Configuration reference and plan docs updated.Evidence