ARTEX/docs/bubblewrap-backend-plan.md

8.6 KiB

Execution backend decision: Docker supersedes the bubblewrap plan

Status: the former Go/bubblewrap implementation prerequisite is superseded. Reconciled 2026-12-02 against main 8f91643. The historical filename is retained so existing PR/issue links keep working. Companion: scope/audit design and completion matrix.

Decision

Use and harden the Docker backend that upstream already ships. Do not introduce an external bwrap binary, a second supervisor/private bridge or a new runtime selection dependency merely to implement the old plan literally. The requirement was a managed execution boundary; Docker satisfies substantial parts of it using a different implementation. It does not automatically satisfy every proposed policy, audit, action-authorization or platform requirement.

The earlier plan remains available in the previous design revision. It is history, not an instruction to replace current Docker defaults. A future alternative backend requires a concrete unmet need and separate acceptance.

Implemented execution boundary

Main's Compose configuration and sandbox mode contract default to ARTEX_SANDBOX=required. off is an explicit degraded mode with warnings, not a fallback when Docker fails. The panel authenticates to artex-runner; the runner controls Docker via its socket. The worker receives neither that socket nor the runner's bearer token.

For each task, DockerBackend creates:

  • One worker container for that task's command executions, including concurrent logical workers. It runs as UID/GID 10001, with a read-only root filesystem, all capabilities dropped, no-new-privileges, a task workspace and bounded tmpfs. The main baseline mounts the workspace; pending #596 adds only the public CA bundle as an additional read-only file mount.
  • One internal task network. The worker has no general external-network attachment.
  • One egress proxy attached to both the internal task network and the egress network. It enforces approved domain/CIDR scope and pins upstream dials. Its audit directory is not mounted into the worker.

Model calls, scheduling, approvals and the logical agent loop remain in the panel. Panel HTTP/WebFetch use separate task-scope checks. Browser, MCP and file services must be evaluated by their actual execution path, not declared isolated because Bash uses Docker. Task-level separation does not make processes within the same task mutually untrusted peers with private per-run credentials/workspaces.

Existing contracts and limits

Area Main implementation Remaining acceptance boundary
Runner API Bearer-authenticated health, exec, kill and delete; structured argv, cwd, filtered environment, timeout and scope fields This is the actual API in runner.go and types.go, not the old proposed versioned policy/capability/session API.
Admission Required-mode checks fail without a usable runner/Docker; no automatic local execution fallback Diagnose missing images, credentials, networking and effective host capabilities; startup success alone does not qualify every isolation property.
Worker limits 2 GiB memory, 2 CPUs, PID limit 512; exec output bounded by the runner Settings are container-level, shared by sibling executions. They are not an end-to-end task network budget or aggregate accounting for panel/MCP work.
Proxy limits 256 MiB memory, 0.5 CPU, PID limit 128 Attribute proxy costs separately; audit/network saturation and failure behavior still need explicit contracts.
Egress HTTP/CONNECT/SOCKS TCP with scope and final-address checks Main's CONNECT/SOCKS are opaque. No complete port/protocol/path/explicit-deny policy translation, universal browser/MCP enrollment or immediate live-policy revocation guarantee follows.
Evidence Proxy-owned connection JSONL Full URL audit, task-proxy credentials, CA mounts and authenticated collection are pending in #596, not in this main baseline.
Identity Task-bound container/network/workspace, filtered execution environment Independent hostile workers within one task are not separately contained; exact run/tool-call attribution requires additional trusted correlation.
Maintenance Existing runner/worker/proxy images and Go/Docker integration Continue dependency/image updates, effective-limit tests and compatible rollback. Do not add bwrap package/version qualification as a duplicate release blocker.

CPU/memory/PID settings are applied through Docker container creation before commands execute. The support matrix must still verify that a particular host actually enforces them. Existing task/intent token, turn and wall-clock budgets remain authoritative; use their ledger rather than introduce competing accounting. The larger budget contract is in the main design.

Lifecycle work now merged

PR #764 is merged at this baseline. It serializes task lifecycle changes, rejects unproven exec completion, removes the exact worker after timeout/cancellation/failure, preserves replacement workers from delayed cleanup, and removes workers before deleting their networks. Failed removal keeps identifiers available for retry.

Whole-container removal terminates that task's sibling executions too, while preserving its workspace and leaving other tasks' workers alone. Pause/Kill can use the UID process scan and retain the proxy/network; the deletion path is a different operation. Do not turn process cleanup tests into a claim that every existing proxy tunnel is synchronously revoked by a scope edit. Scope revocation, long-lived channels and control-plane/policy failure remain explicit test cases.

Relevant regressions: exec cleanup, concurrency, delete/kill retry, real Docker containment and exec wrapper implementation.

Compatibility and qualification

Preserve the five controller release targets and the Linux amd64/arm64 container builds in the release workflow. Those are build contracts, not evidence of native Windows/macOS isolation. Linux containers on a Desktop/VM/remote daemon execute Linux tools; host sharing, credentials, mounts, networking, restart/revocation and effective limits need separate tests.

The earlier cc01 x86_64 Docker results are useful scoped evidence for the tested branch, not an ARM64/Desktop/fleet certification. A documentation update does not extend that support matrix. Kernel/VM comparisons and storage quota design are not expanded in this revision, and no new guarantees in those areas are claimed.

The network compatibility tradeoff remains explicit: approved destinations can carry callbacks or data exfiltration even after an injected action is confined. Docker and URL logging do not promise reverse-shell prevention. Stronger action or protocol restrictions need separately reviewed policy and compatibility tests.

For pending #596, deploy matching panel/runner/proxy images and preserve its per-task public-CA-only mount and independent proxy credentials. Pinning, mTLS and HTTP/2-only clients cannot use its HTTPS inspection path; SOCKS remains opaque. Rollback restores compatible components, not unsandboxed execution, and preserves retained audit data.

Remaining work instead of a second backend PR

  1. Reconcile and complete #596's audit/investigation acceptance, including exact action/artifact and secondary-destination evidence; do not call its Draft code merged or treat connection metadata as full URL evidence.
  2. Extend current scope/gates with the remaining policy, indirect-action, budget, trusted-provenance and revocation contracts in the main design.
  3. Maintain synthetic Linux regressions for missing proxy variables, cross-task access, failed cleanup, restart, timeout effects on siblings, long-lived channels, output pressure and effective resource limits. Qualify additional platforms only with actual platform tests.

The original four-PR order is retired. Existing Docker implementation and merged #764 count as delivered work; tests and packaging stay with the behavior they validate. Do not recreate completed work to preserve planning slot numbers.