Repository navigation
feat(nodes): opt-in container isolation for node-hosted worker sessions - #128447
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs real behavior proof before merge. Reviewed August 23, 2026, 10:25 PM ET / August 24, 2026, 02:25 UTC. ClawSweeper reviewWhat this changesAdds opt-in Docker/Podman isolation for node-hosted worker sessions, including configuration, durable launch tracking, tests, and documentation. Merge readiness⛔ Blocked until stronger real behavior proof is added - 11 items remain Keep open: the opt-in isolation feature has three unresolved lifecycle/security defects and lacks the required old-reader upgrade proof. Priority: P2 Review scores
Verification
How this fits togetherNode hosts receive Gateway-dispatched worker launches and run verified bundles against session workspaces. This change inserts a local container-engine boundary before the worker reports its result and capacity back to the Gateway. flowchart LR
A[Gateway worker request] --> B[Node host admission]
B --> C[Container engine validation]
C --> D[Durable launch journal]
D --> E[Isolated worker session]
E --> F[Cleanup and result]
F --> G[Gateway capacity update]
Before merge
Findings
Agent review detailsSecurityNeeds attention: A changed daemon can receive the worker-launch side effect before the requested isolation identity is revalidated. PR surfaceSource +1125, Tests +1007, Docs +78, Generated +1. Total +2211 across 31 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Make container identity durable before start, revalidate the selected daemon before every container side effect, fail closed on unsupported Windows hosts unless safe path mapping is implemented, and prove candidate-to-v9-to-candidate database use. Do we have a high-confidence way to reproduce the issue? Yes. Source establishes both a daemon-swap path that reaches container creation without revalidation and a cancellation interleaving that frees capacity before startup cleanup completes. Is this the best way to solve the issue? No. The current design needs final-effect daemon validation, a durable pre-start container record, and an explicit supported-platform boundary before it can safely provide the claimed containment. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 1ac7f0161c9e. LabelsLabel changes:
Label justifications:
EvidenceSecurity concerns:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (2 earlier review cycles)
|
|
All review findings are addressed on head 79a5e258fbc:
Fresh real-behavior proof on this head: live rig (gateway + paired node from 79a5e258fbc, |
nodeHost.workerRuns.isolation=container runs each worker session inside a Docker-compatible container (docker/OrbStack/podman): stdio launch transport, exactly two bind mounts (bundle read-only, workspace read-write), allowlisted env, and the container itself as the durable launch identity — created stopped and journaled before the descriptor is delivered, killed/removed on cancel, fence, shutdown, and recovery, with an owned-orphan sweep at startup. Missing or changed engines disable hosting with an explicit diagnostic instead of falling back to bare processes. Additive nullable worker_container_json column on node_worker_launches (schema version unchanged).
node_worker_launches is excluded from claw-scoped state schemas, so the read-only compat fixture cannot drop its additive column there; drop only columns whose owning table exists.
- Revalidate the engine daemon target immediately before container creation; a replaced daemon receives zero create/start requests (regression proves it). - A pending launch keeps its worker slot until the journaled container is killed/removed; cancellation cannot free capacity over a live container. - Windows node hosts fail closed at startup for isolation=container with an actionable diagnostic (native paths cannot be container mount targets). - Container identity moves from an additive column to the same-version companion table node_worker_launch_containers (bare STRICT, lazily ensured on first container write, pruned with the launch journal): the launch table is contract-optional and shipped readers reject additive columns there. An exact v9 predecessor now provably opens and uses the journal after the candidate populated container rows.
79a5e25 to
d74aabf
Compare
|
Merged via squash.
|
…ns (openclaw#128447) * feat(nodes): opt-in container isolation for node-hosted worker sessions nodeHost.workerRuns.isolation=container runs each worker session inside a Docker-compatible container (docker/OrbStack/podman): stdio launch transport, exactly two bind mounts (bundle read-only, workspace read-write), allowlisted env, and the container itself as the durable launch identity — created stopped and journaled before the descriptor is delivered, killed/removed on cancel, fence, shutdown, and recovery, with an owned-orphan sweep at startup. Missing or changed engines disable hosting with an explicit diagnostic instead of falling back to bare processes. Additive nullable worker_container_json column on node_worker_launches (schema version unchanged). * fix(test): base-shape fixture skips additive columns of stripped tables node_worker_launches is excluded from claw-scoped state schemas, so the read-only compat fixture cannot drop its additive column there; drop only columns whose owning table exists. * fix(test): guard split destructuring in base-shape fixture * test(state): record worker_container_json in the canonical additive-column list * fix(nodes): harden container isolation per review findings - Revalidate the engine daemon target immediately before container creation; a replaced daemon receives zero create/start requests (regression proves it). - A pending launch keeps its worker slot until the journaled container is killed/removed; cancellation cannot free capacity over a live container. - Windows node hosts fail closed at startup for isolation=container with an actionable diagnostic (native paths cannot be container mount targets). - Container identity moves from an additive column to the same-version companion table node_worker_launch_containers (bare STRICT, lazily ensured on first container write, pruned with the launch journal): the launch table is contract-optional and shipped readers reject additive columns there. An exact v9 predecessor now provably opens and uses the journal after the candidate populated container rows.
What Problem This Solves
Node-hosted worker sessions run as bare child processes on the host — the only hardening is a frozen env allowlist.
docs/plan/runners.mdexplicitly parked "worker-in-docker/podman" as remaining milestone-6 work. Operators running session farms on their own machines have no per-session containment.Why This Change Was Made
Adds opt-in container isolation, node-local like every other
workerRunssetting:worker_container_jsoncolumn onnode_worker_launchesvia the sanctioned lazy additive-column mechanism — schema version unchanged (9), older readers safe (bare nullable TEXT, zero constraints).docker runwithout durable ownership, mounting the broader bundle root, reusing the gateway-local sandbox lifecycle (different ownership/reconciliation boundaries).User Impact
nodeHost.workerRuns.isolation: "container"gives each worker session a real container boundary on any node with a Docker-compatible engine; default behavior ("none") is byte-identical. Docs: isolation section indocs/nodes/index.md;docs/plan/runners.mdmilestone updated.Evidence
Live proof on a dev rig (gateway from this branch, paired node with
isolation: "container",containerImage: node:22.22.3-bookworm):openclaw-node-worker-…onnode:22.22.3-bookworm(docker psmid-turn).iso.txt) reconciled back into the gateway-side managed worktree.openclaw-node-workercontainers remained (docker ps -a).Suites:
OPENCLAW_VITEST_MAX_WORKERS=4 pnpm test src/node-host src/config— 3,873 passed / 2 skipped (290 files); fake-engine supervisor tests cover args/mounts/labels/env, result round-trip, kill-on-cancel, orphan sweep, dead-container identity; startup fail-closed test for missing engines; config schema accept/reject.pnpm check:changedgreen post-rebase (incl. database-first checks, SQLite schema version unchanged, Kysely types verified). Codex autoreview (branch vs origin/main): clean, no accepted/actionable findings (0.96).Review round 2/3 (head 79a5e258fbc)
All four ClawSweeper findings addressed: per-launch daemon-target revalidation before container creation (fake-engine regression proves a replacement daemon receives zero create/start requests); pending-cancel keeps the worker slot until the journaled container is removed; Windows fails closed at startup for container isolation; and container identity restructured from an additive column into the same-version companion table
node_worker_launch_containers(the launch table is contract-optional, whose shipped readers reject additive columns — the review finding exposed a real design error). The exact v9 predecessor-reader proof now passes under the real contract code.Fresh live proof on this exact head: dispatch → worker container observed running mid-turn (
node:22.22.3-bookworm) → file created in-container reconciled to the gateway worktree → zero leftover containers → completed launch journal with exactly one companion-table row.