|
| 1 | +--- |
| 2 | +summary: "Internal operator reference for the restricted cloud worker runtime" |
| 3 | +read_when: |
| 4 | + - Operating or debugging gateway-launched cloud workers |
| 5 | + - Verifying worker admission, session assignment, or local tool isolation |
| 6 | +title: "Worker" |
| 7 | +--- |
| 8 | + |
| 9 | +# `openclaw worker` |
| 10 | + |
| 11 | +`openclaw worker` is the restricted runtime entry point for a cloud worker |
| 12 | +orchestrator to launch inside a prepared worker environment. It is not a |
| 13 | +general-purpose command for manual worker registration. |
| 14 | + |
| 15 | +The gateway installs the matching OpenClaw bundle and opens the host-key-pinned |
| 16 | +reverse SSH tunnel. The worker launcher starts this command with a prepared |
| 17 | +assignment. The command connects through the tunnel-forwarded local socket and |
| 18 | +admits as the dedicated `worker` role. |
| 19 | + |
| 20 | +## Launch contract |
| 21 | + |
| 22 | +The command reads exactly one bounded JSON launch envelope from standard input. |
| 23 | +The envelope carries the local socket location, minted worker credential, bundle |
| 24 | +and protocol identity, owner epoch, and the single assigned session and turn. |
| 25 | +The credential is never accepted through command-line arguments, and this page |
| 26 | +intentionally provides no credential or hand-authored envelope example. |
| 27 | + |
| 28 | +Admission fails closed if the envelope is invalid, the credential is rejected, |
| 29 | +the bundle or protocol features do not match, or the session and owner epoch are |
| 30 | +no longer current. Operators should start workers through the cloud worker |
| 31 | +orchestrator rather than invoke this entry point directly. |
| 32 | + |
| 33 | +## Runtime boundary |
| 34 | + |
| 35 | +The process runs the normal embedded agent loop with a restricted backend: |
| 36 | + |
| 37 | +- The `read`, `write`, `edit`, `apply_patch`, `exec`, and `process` coding tools |
| 38 | + run locally in the worker workspace. |
| 39 | +- Model calls use the gateway inference proxy. No local model auth profile is |
| 40 | + loaded. |
| 41 | +- Transcript writes use the gateway transcript-commit RPC. |
| 42 | +- Streaming and tool lifecycle updates use the gateway live-event RPC. |
| 43 | +- Only the assigned session and turn are accepted. |
| 44 | + |
| 45 | +Worker mode does not start channels, Gateway HTTP surfaces, or plugin auto-start |
| 46 | +beyond the assigned session toolset. It uses a throwaway state directory and has |
| 47 | +no standing provider or forge credentials. |
| 48 | + |
| 49 | +Worker-to-worker session dispatch is not exposed in this mode. Agent dispatch |
| 50 | +and placement remain gateway-owned milestone-3 surfaces. |
| 51 | + |
| 52 | +The prepared assignment carries the transcript context, accepted base leaf, |
| 53 | +commit sequence, and live-event cursor. On a tunnel reconnect, the process |
| 54 | +re-admits with the same credential and owner epoch, retains the accepted |
| 55 | +transcript base, replays its unacknowledged live-event tail, and reattaches an |
| 56 | +in-flight inference turn with the same identity. The terminal inference message |
| 57 | +is authoritative if streamed deltas were missed. A superseding owner epoch |
| 58 | +fences the process and causes a clean exit. |
| 59 | + |
| 60 | +A `stale-base-leaf` transcript rejection fail-stops the current run. Worker |
| 61 | +mode does not retry the rejected sequence against a different leaf, so no |
| 62 | +duplicate commit is produced; any still-uncommitted in-memory tail from that |
| 63 | +run is lost. Relaunch belongs to the milestone-3 placement owner, which must |
| 64 | +create a fresh assignment from the gateway's authoritative transcript and |
| 65 | +commit ledger. Likewise, a gateway process restart terminates a pending |
| 66 | +inference turn with a provider error; only a tunnel or worker WebSocket |
| 67 | +reconnect can reattach to an active same-process inference stream. |
| 68 | + |
| 69 | +See [Gateway protocol](/gateway/protocol#worker-role-and-closed-protocol) for the |
| 70 | +closed worker RPC surface and [Cloud workers plan](/plan/cloud-workers) for the |
| 71 | +architecture and security model. |
0 commit comments