Skip to content

Latest commit

 

History

History
384 lines (322 loc) · 22.7 KB

README.md

File metadata and controls

384 lines (322 loc) · 22.7 KB

Runtime image recipe

Build the OpenClaw Enterprise runtime image for local quickstart and integration tests. The image provides these entrypoints.

  • OpenClaw gateway: node /app/openclaw.mjs.
  • Dedicated OpenClaw node: node /app/openclaw.mjs connect --target-file <private-file> --ephemeral --pair-or-reconnect.
  • Dedicated Codex app-server: codex app-server.

NPM_CONFIG_UPDATE_NOTIFIER=false disables npm's background version check. Package installation and explicit network requests still use the configured network policy.

The Dockerfile uses a verified public OpenClaw archive, its pinned package manager, frozen lockfile, and upstream Docker assembly. A registry mirror requires separate Corepack and pnpm build secrets. Both Codex entrypoints use stock Codex 0.164.0, unpatched; stock-codex-0.164.0-dependency-pin.patch holds the lockfile there and sets CODEX_APP_SERVER_VERSION back to it while OpenClaw bundles 0.169.0. Verify native startup and sandbox behavior with the image's seccomp rules. Codex and Slack come from the same source, whose restricted workspace-node commands and persistent device identity support split storage. That contract requires a newer source than 2026.9.5.

OCE builds an unreleased OpenClaw commit that supports Gateway managed mode and the separate tool policy for dedicated Harnesses. Managed mode restricts native config writes, Gateway-local terminals and Gateway-hosted command jobs. The tool policy limits model turns in both modes. When a child spawns, OpenClaw waits for placement started by session creation and rechecks the parent's authority before dispatch. The source also preserves shared host-module links during plugin capture and handles bundled WebAssembly and directory assets. Until upstream ships OpenClaw #158724 or an equivalent, the build applies its readOnlyPaths compatibility change as openclaw-codex-read-only-paths.patch. This preserves the restricted Codex filesystem profile required by the repository broker and selected plugins. The selected source preserves on-request when plugins use MCP elicitation, reconnects connect --ephemeral with saved device credentials after its setup code expires, and retains the original caller's authority while required-worker placement continues after session creation is acknowledged. Scope, role, and profile revocation still stop dispatch. OpenClaw #196972 adds an opt-in wait for admitted work and final writes. The build also applies openclaw-codex-full-access-profile.patch, which selects the native full-access Codex profile. Remove it once upstream matches. openclaw-terminated-gateway-namespace.patch lets a supervisor that verified a private Linux PID namespace stopped recover its Gateway records, or, inside it, any record whose PID is dead. OC compares its lock fingerprint first. Unattributed owners need operator confirmation. Restart recovery in the selected source waits for workspace reconnection and surviving Codex work before continuing. The pin includes upstream #185180: final delivery retains its progress window after a long Codex turn.

openclaw-node-setup-renewal.patch adds --pair-or-reconnect for first enrollment or renewal under the same binding. Fresh setup comes first; a typed bootstrap rejection allows one validated saved-token retry. See node enrollment for Gateway/TLS-pin checks, local credential retirement when switching targets, and pairing recovery. Remove this bridge once the source provides that contract. OCE omits restart scopes and keeps upstream policy unchanged. Previously scoped work may be refused; see interrupted turns. Provenance patches records each patch's SHA-256 in order; tests compare scripts/build-runtime-assets.ts with the Dockerfile.

Dedicated Gateways require the supporting source recorded in this recipe and validate their effective native configuration before starting. The required Gateway tool policy covers core dispatch, automation authority and Codex dynamic tools. Older or unknown source images remain unready; source checks and configuration validation do not replace runtime qualification.

The Codex adapter preserves namespaced IDs with an explicit native provider. For a custom endpoint, OCE compiles its private Gateway model references to include that provider while keeping the admitted Configuration unchanged. See native runtime selection.

Dedicated native OpenClaw requires both required worker placement (cloudWorkers.requiredProfile) and node-local inference from canonical models.providers configuration. The node snapshots its model credentials and projects each worker's managed workspace from its authorized launch descriptor; OCE does not write the retired nodeHost.workerRuns.nativeInferenceConfig field.

The selected source includes required placement activation, node-local model/workspace projection, and the Codex native-child relay. OCE advertises pinned-runtime native-worker support, so the Console offers Dedicated OpenClaw without a custom-image declaration. When the same node hosts an admitted MCP tool, the worker can call its MCP client locally. Tools that require Gateway policy hooks continue through the Gateway. Deployment still requires a provisioning SandboxDriver with networking, filesystem, and process containment.

The images-runtime-startup lane runs the production Gateway and Harness entrypoints and validates their generated configurations with the image's CLI. Native AMD64 and ARM64 image checks and real deployment verification remain separate requirements. Schema acceptance alone does not prove placement, enrollment, containment, workspace access, or model execution.

Input Selection
Build base docker.io/library/node:24.22.1-bookworm@sha256:6449e19d8184d84062525b6a7524def03146c2cb04a7f08b076680d0e8e4240a
OpenClaw commit, archive SHA-256, and build timestamp Source manifest
Dedicated Codex CLI (OPENAI_CODEX_VERSION) 0.164.0
Matrix crypto native library @matrix-org/matrix-sdk-crypto-nodejs v0.6.6, SHA-256 per architecture

The upstream package version is 2026.11.5. Identify the custom build by /opt/oce/runtime/provenance.json. It records the source commit, archive, patch and lockfile hashes, package manager, plugins, architecture, Codex package identity, and SHA-256 of contents.json. That file lists packaged files, modes, hashes, and symlinks after permission normalization.

The final stage copies the assembled directory directly into the pinned node:24.22.1-bookworm-slim base with runtime libraries, Git/SSH, GitHub CLI, Python, and process utilities. Both bases apply current Debian updates. The stock runtime excludes build compilers. Selecting Cargo adds the Rust compiler and a system linker. The slim-base repository credential client compiles only its own sources without typechecking. The service builds and typechecks the workspace.

Building requires registry access. A disposable stage installs plugin build dependencies. The production stage selects required upstream plugins plus Codex and Slack, installs dependencies for the target architecture with lifecycle scripts enabled, and runs upstream postinstall, pruning, import-closure, and native filesystem-addon checks. Pruning removes tests, QA source, documentation media, and unreachable pnpm entries. It keeps help, skills, templates, importer-specific versions, and installed optional dependencies.

Resolve OpenClaw build arguments

openclaw-source.json selects the OpenClaw commit, source archive checksum, and fixed upstream build timestamp. Update these values together when changing the selected source; follow the oce-cookbook pin-update recipe. The runtime Dockerfile has no source defaults: missing or invalid arguments, or arguments that differ from this manifest, fail the build before the source archive download. Archive checksum verification remains required.

From the repository root, run this in Bash with Node.js 24 or newer:

source_args="$(node scripts/lib/openclaw-source.ts build-args)" || exit 1
openclaw_build_args=()
while IFS= read -r argument; do
  openclaw_build_args+=(--build-arg "$argument")
done <<< "$source_args"

Keep this shell for the build. CI and development launchers resolve the manifest automatically.

Verify runtime source

Local assembly omits broad suites. Run source verification for runtime changes.

See the JIT-free ARM64 Harness.

Build a local runtime image

For paired builds, see QA prebuilds and caching. Otherwise resolve build arguments and run:

docker build -f deploy/runtime/Dockerfile \
  "${openclaw_build_args[@]}" \
  --tag openclaw-enterprise-runtime:quickstart \
  .

Corepack or pnpm certificate errors: use build-ca; verify TLS. Image registries use builder trust.

Set OCC_DOCKER_RUNTIME_IMAGE=openclaw-enterprise-runtime:quickstart for the Compose quickstart. The Docker Compute Driver uses the same image for embedded OpenClaw gateways and dedicated Codex app-server containers.

The image preserves the assembled OpenClaw runtime under /app/node_modules/openclaw and exposes /app/openclaw.mjs and /app/dist as symlinks into that package. /app/skills is copied into a real directory so each Kubernetes runtime can initialize its own bundled Skill assets. Gateway and Harness do not share a runtime-assets volume. Do not flatten /app/dist; OpenClaw resolves package-local runtime dependencies from its installed package root.

Codex and Slack are packaged under /app/dist/extensions/ with their runtime dependencies. They must load from a fresh runtime home without downloading or installing packages at gateway startup. Slack credentials remain operator-owned runtime Secrets; do not put them in the image.

The matrix-sdk-crypto stage fetches the Matrix crypto library with the retrying, checksum-verifying download helper, and both installs read it from a loopback server instead of GitHub. When an OpenClaw update changes the locked @matrix-org/matrix-sdk-crypto-nodejs version, update that stage's version, URL and both SHA-256 values. Until then the install fails with a "no pinned file" message. The source manifest selects the commit OCE builds. Its upstream Dockerfile keeps plugin dependencies separate when their versions differ from core. Plugin chunks emitted directly under dist also need package-root resolution. The assembly links missing plugin dependencies into that root without replacing existing core dependencies. The custom npm-distribution packer rejects that combination because it requires one shared dependency version.

The Bookworm bases supply stock Node.js 24.22.1+ in the 24 series. On 24.22.1, terminating a worker during synchronous CommonJS-to-ESM loading can abort the Gateway and interrupt active turns. Native qualification must check Gateway shutdown and restart.

The Dedicated command and bundled plugin both resolve the same Codex 0.164.0 installation. For multi-architecture builds, the frozen npm install selects the stock @openai/codex-linux-x64 or @openai/codex-linux-arm64 package for the target architecture. The image rebuilds /opt/oce/runtime/contents.json from /app/node_modules/openclaw and updates /opt/oce/runtime/provenance.json#runtimeContentsSha256 after final permission normalization. Its codex provenance records the stock package source, version, lockfile integrities, platform package, and installed binary path and digest. The OpenClaw bridge forwards the repository-bound Agent's stock allow_local_binding = true and mode = "full" settings; the networking contract defines their scope and remaining controls. Update the dependency pin, sandbox review, and compatibility assertions together when changing that version. The alpha pin requires successful native AMD64 and ARM64 image verification before merge. Run the compatibility check below against the resulting image. Provider model availability still requires a real model turn with the selected credential.

Production Kubernetes installations can use this recipe as a starting point, but must push the resulting image to an operator-controlled registry and configure the Kubernetes Compute Driver with immutable @sha256: image references. Follow Build and publish production images for the controller and runtime build commands, registry publishing, and digest configuration.

Review the managed Google plugin pin

The managed Google release links Peter Steinberger's gog skill on ClawHub to its reviewed SKILL.md bytes at an immutable OpenClaw commit. When updating the pin, check the publisher, read the selected version, and compare its file digest with the manifest from the repository root.

manifest=apps/controller/plugins/oce-google-workspace/ai.openclaw.oce/release.json
clawhub inspect "$(jq -r .clawhub.skill "$manifest")" \
  --version "$(jq -r .clawhub.version "$manifest")" --files --json |
  jq -e --arg sha "$(jq -r .clawhub.skillSha256 "$manifest")" \
    'any(.version.files[]; .path == "SKILL.md" and .sha256 == $sha)'

The build verifies the upstream skill pin, the packaged oce-google instructions, the gog CLI archive for the image architecture, and the executable’s checksum and reported version. The binary lives under /usr/local/lib/oce/plugins/google/bin, outside the image’s default PATH.

A selected dedicated OpenClaw worker verifies the bundled release and binary before enrollment, then adds that directory to its PATH. The Gateway verifies the bundled skill and adds it to native skill discovery. OpenClaw’s usual precedence applies if the workspace contains another skill with the same name. Run gog --version in the worker to check the installation.

For account selection and deployment, see Configure Agent plugins.

OCE grants its workspace node read access to the selected skill. If you supply a custom file-transfer policy for that node, allow reads of /usr/local/lib/oce/plugins/google/skills, its oce-google directory and oce-google/SKILL.md.

Select a storage-split test image

Build Gateway and Harness images from this same pinned distribution, record each immutable image digest, and follow the existing Kubernetes test procedures. The complete upstream interfaces and remaining Enterprise acceptance are tracked in #76. Source inclusion and image startup do not prove routed enrollment, saved-token reconnect, all seven workspace operations, or model execution in a deployed environment.

Rebuild an existing image

scripts/dev-up reuses the configured image tag and builds the default openclaw-enterprise-runtime:quickstart image only when that tag is absent. After changing this recipe or its pinned inputs, run the build command above explicitly, verify the rebuilt image, then run ./scripts/dev-up again. For a custom OCC_DOCKER_RUNTIME_IMAGE, build or pull that selected tag yourself.

For Kubernetes, publish the rebuilt image and update both Installation image references to its verified immutable digest. Separate gateway and Codex images require verification of that exact pair through the Kubernetes runtime tests.

Select optional native tools

Edit the download client list in the source you plan to build. The default [] adds no tools. Select only the paths you need for Linux amd64 and arm64. For example, ["/opt/devtools/bin/go"] adds Go.

Inventory path Installed tools
/opt/devtools/bin/rustup Rustup 1.29.1
/opt/devtools/bin/cargo Cargo, rustc, rustdoc, and the Rust standard library at 1.95.0 with a linker
/opt/devtools/bin/go Go 1.27.3, its standard library, and gofmt
/opt/devtools/bin/bun Bun 1.4.4

The image exposes these tools on PATH with root-owned links in /usr/local/bin. Cargo uses the packaged Rust toolchain. Rustup manages its own toolchains. Rebuild the image and verify both architectures before using it.

Verify both native architectures

Run Check Native Container Images for the selected commit. Require controller and runtime smoke on native AMD64 and ARM64. For a custom release, follow the protected publication procedure.

Verify the local image

docker run --rm openclaw-enterprise-runtime:quickstart \
  node /app/openclaw.mjs --version

docker run --rm openclaw-enterprise-runtime:quickstart \
  codex --version

Then run the runtime startup smoke from the repository root with host Node.js 24+. The image test environment and Docker fixture requirements are documented in Image and Helm tests:

node scripts/ci/prepare.ts --lane images-runtime-startup --state /tmp/images-runtime-startup.json --github-env /tmp/images-runtime-startup.env
set -a
. /tmp/images-runtime-startup.env
set +a
OPENCLAW_ENTERPRISE_CI_STATE=/tmp/images-runtime-startup.json \
  node --test tests/integration/runtime-image-startup.test.ts \
    tests/integration/runtime-image-gateway-workspace.test.ts \
    tests/integration/runtime-image-state-migration.test.ts \
    tests/integration/runtime-image-managed-files.test.ts \
    tests/integration/runtime-image-native-listener.test.ts \
    tests/integration/runtime-image-startup-probe.test.mjs \
    tests/integration/runtime-image-startup-termination.test.ts \
    tests/integration/runtime-image-gateway-unclean-restart.test.ts \
    tests/integration/runtime-image-gateway-retained-state.test.ts \
    tests/integration/runtime-image-gateway-peer.test.ts \
    tests/integration/runtime-image-native-worker.test.ts

The smoke starts task-owned containers with the Docker Compute Driver gateway entrypoint, the Kubernetes Compute Driver gateway entrypoint, and the native Codex command execution path, UID 1000:1000, a read-only root filesystem, and tmpfs-backed runtime directories. The private broker endpoint smoke requires the reviewed Codex 0.164.0 seccomp profile above so the nested bubblewrap sandbox can start without broadening to an unconfined Docker seccomp profile. Passing means an embedded OpenClaw gateway reaches /readyz from a fresh home, the bundled Codex and Slack plugins load without missing package dependencies, the installed Codex plugin successfully initializes the image's real Codex app-server, and the Kubernetes dedicated-gateway startup path publishes the bundled skills directory into /home/node/openclaw-runtime-assets. These checks run without external network access or provider credentials. The smoke also enrolls a real restricted workspace node under the production supervisor with an inert Codex sibling. It requires exactly seven commands, retained identity across redeemed/expired-code restarts and file/envelope setup replacement, and one completion per setup. These checks do not exercise all workspace command payloads, make a model call, or establish a Slack connection. When running this suite from inside another container that talks to a host Docker daemon, mount the repository and any temporary fixture directory at the same absolute host path and set TMPDIR inside that shared path; otherwise nested Docker bind mounts can turn missing host files into directories.

Before enabling Slack in an Installation, run the live Slack test with the verified image, projected credentials, and the required proxy configuration. It must prove a real mention, Codex turn, and gateway-authored reply; gateway readiness alone is insufficient.

The runtime includes a Debian-compatible curl security backport for both curl and Git. See the publication flow for its provenance, verification, and scanner limitations.

Build provenance

The publisher passes the checked Enterprise source SHA as OCC_BUILD_REVISION. The runtime image records it in the OCI revision label and /opt/oce/runtime/build.json. The private runtime status endpoint exposes only that validated commit and the upstream OpenClaw commit from /opt/oce/runtime/provenance.json for the console's debug=true image panel. The org.openclaw.image.revision label records the same upstream commit for Docker inspection; the build checks that it matches packaged provenance. Local builds can pass --build-arg OCC_BUILD_REVISION=<full-lowercase-git-sha>; omitted metadata remains unknown. Rebuild the runtime image to include this metadata.