Repository navigation
feat(cloud-workers): openclaw worker mode running the embedded loop on the box - #105865
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9caca6d6d4
ℹ️ 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".
| config: { plugins: { enabled: false } }, | ||
| exec: { host: "gateway", security: "full", ask: "off" }, |
There was a problem hiding this comment.
Scrub ambient environment before enabling worker exec
When openclaw worker is launched from an environment that still has host secrets (for example OPENAI_API_KEY, GITHUB_TOKEN, or SSH_AUTH_SOCK), this full local exec surface inherits process.env through the existing exec tool path (src/agents/bash-tools.exec.ts:1799), while the worker runtime only overrides OPENCLAW_STATE_DIR and OPENCLAW_CONFIG_PATH. In that scenario the model can run exec/process to print or use those secrets and send them back through transcript/live events, which breaks the restricted-worker guarantee that no standing provider or forge credentials are available locally. Please clear/sandbox the worker process environment, or pass a scrubbed env into local shell tools before enabling them.
Useful? React with 👍 / 👎.
|
Codex review: needs real behavior proof before merge. Reviewed July 13, 2026, 5:31 AM ET / 09:31 UTC. Summary PR surface: Source +3543, Tests +2079, Docs +84. Total +5706 across 32 files. Reproducibility: yes. for the review defects: current-head source shows the unset workspace-only policy, unreserved stdout, and cancellation request's ready-connection dependency. The complete cloud-worker feature itself still lacks a real-environment run. Review metrics: none identified. 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
Security Review findings
Review detailsBest possible solution: Constrain every worker file tool to the assigned workspace, reserve stdout exclusively for the launcher result, make inference cancellation survive reconnects, and demonstrate the complete flow with redacted real-worker terminal or log evidence before landing. Do we have a high-confidence way to reproduce the issue? Yes for the review defects: current-head source shows the unset workspace-only policy, unreserved stdout, and cancellation request's ready-connection dependency. The complete cloud-worker feature itself still lacks a real-environment run. Is this the best way to solve the issue? No, not yet: the architecture follows the approved milestone contracts, but the composition is not the best safe implementation until tool confinement, launcher framing, and durable cancellation are corrected. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against c43c960aad1b. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +3543, Tests +2079, Docs +84. Total +5706 across 32 files. View PR surface stats
Security concerns:
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)
|
9caca6d to
7cd52fa
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7cd52fa3c7
ℹ️ 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".
| policy: { | ||
| bypassConfigGuard: true, | ||
| hideBanner: true, | ||
| loadPlugins: "never", | ||
| networkProxy: "bypass", |
There was a problem hiding this comment.
Reserve stdout for worker protocol output
openclaw worker writes its machine-readable launcher result to stdout (src/worker/worker.runtime.ts:237-239), but this policy does not mark the command as owning protocol stdout. In that configuration resolveCliStartupPolicy leaves suppressDoctorStdout false, so console/log diagnostics are not routed to stderr before the worker starts; any info/warn emitted while constructing tools or running the local agent can be mixed into the only JSON response the orchestrator parses. Please set ownsProtocolStdout: true for this command, like node worker does.
Useful? React with 👍 / 👎.
| !isIdentifier(value.runId) || | ||
| !isIdentifier(value.turnId) || | ||
| typeof value.prompt !== "string" || | ||
| !isIdentifier(value.workspaceDir) || |
There was a problem hiding this comment.
Accept valid workspace paths in launch descriptors
The parser reuses isIdentifier for workspaceDir, which applies the worker identifier length cap and trimming rules before the later path.isAbsolute/stat validation. If the orchestrator prepares a valid absolute checkout under a long nested worktree/temp path (over 256 characters), the worker rejects the launch descriptor before it can admit, even though the directory is valid. Validate this field as a bounded absolute path string rather than as a protocol identifier.
Useful? React with 👍 / 👎.
fe1a277 to
207f51c
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 207f51cf93
ℹ️ 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 authStorage = AuthStorage.inMemory({}); | ||
| const modelRegistry = ModelRegistry.inMemory(authStorage); |
There was a problem hiding this comment.
Bypass local model-auth preflight for workers
When a worker starts on a clean leased box, or after the ambient-env scrub requested elsewhere, this empty AuthStorage leaves ModelRegistry.hasConfiguredAuth() false for descriptor.assignment.modelRef.provider; AgentSession.prompt() checks that before it ever calls the overridden RPC-backed streamFn, so the turn fails with a local “No API key found” instead of issuing worker.inference.start. Seed a non-secret auth marker/override or bypass the local auth preflight for this worker-only stream path.
Useful? React with 👍 / 👎.
2783eaa to
68c9e97
Compare
0d094eb to
ed722bb
Compare
|
Merged via squash.
|
…n the box (openclaw#105865) * feat(cloud-workers): add restricted worker runtime * test(cloud-workers): cover worker runtime contracts * docs(cloud-workers): document worker mode * fix(worker): bound connection lifecycle * fix(worker): serialize transcript flushes * fix(worker): fail stop stale transcript bases * fix(worker): degrade lossy live streaming * test(worker): cover inference reconnect fencing * refactor(worker): split RPC clients * refactor(worker): split connection transport * refactor(worker): split embedded runtime * refactor(worker): narrow worker module exports
Part of #104294 (cloud workers, milestone 2, PR 9 — the composition PR). Builds on the four landed milestone-2 backend contracts: #104688 (worker role), #104809 (transcript commits), #105275 (live events), #105719 (inference proxy). Design:
docs/plan/cloud-workers.md(openclaw worker mode).What Problem This Solves
The four backend RPCs exist on the gateway side, but nothing yet runs an agent session ON a worker box. This PR adds
openclaw workermode: the entry point + worker-side runtime that dials the gateway over the reverse tunnel, admits with the minted credential + handshake, and runs the embedded agent loop on the box — with its persistence, model, and streaming seams tethered to the gateway, and tools running locally. This is where a worker box becomes capable of running a real session driven from the gateway.Why This Change Was Made
openclaw workerentry: restricted runtime (loadPlugins:"never", no channels, no gateway HTTP surfaces, throwaway mkdtemp 0700 state dir, in-memory empty auth storage — no local model auth profile read). Dials the tunnel-forwarded local socket, presents credential + handshake, attaches to its single assigned session. Fails closed on admission failure (with a bounded 120s admission deadline so a leased box can't burn forever on an unreachable gateway).Deep-review fixes (a dedicated adversarial review found real concurrency/lifecycle bugs)
stoppedstate was indistinguishable from a transient interrupt and the commit retry loop treated it as retryable. Introduced a terminal WorkerConnectionStoppedError; retry loops now retry only transient interruptions and rethrow on any terminal state. Stop-in-flight and post-stop emit settle promptly.User Impact
Opt-in only; dispatch/UI (target bar, placement) is milestone 3. This makes a worker box able to run a session end-to-end. No config/changelog/version-bump changes.
Evidence