Repository navigation
Description
Symptom
Creating an environment (or running an agent conversation) with docker_enabled on the Kubernetes sandbox backend never starts a Pod, and the failure does not name the real cause:
- environment:
Deployment.apps "paca-env-<id>" is invalid: spec.template.spec.containers[1].securityContext ... cannot set allowPrivilegeEscalation to false and privileged to true(a platform policy adding privilege-escalation hardening to the privileged sidecar — that one is fixed separately), and once past it,FailedCreate ... forbidden: violates PodSecurity "baseline:latest": privileged (container "dind" must not set securityContext.privileged=true)on a ReplicaSet retry loop, while the environment's PVC is already created and the row sits increatinguntil it times out. - conversation: the Job is created, its Pod never is.
Every Pod Security Admission level except privileged forbids a privileged container, so on a deployment whose sandbox namespace enforces Baseline — the level deploy/helm/README.md documents as the strictest the Kubernetes backend supports — a docker_enabled sandbox is un-runnable. Nothing in the API, the UI, or agent-runner knows that, so the operator gets minutes of retry loop and an error about a field pair rather than "this deployment cannot run docker".
Fix
Make the capability a first-class deployment setting, default-on so existing deployments are unchanged:
SANDBOX_DOCKER_IN_SANDBOX(defaulttrue) on agent-runner gates the Kubernetes backend's DinD sidecar.Start,CreateEnvironmentandStartEnvironmentrefuse adocker_enabledsandbox before any API write, with an error that names the cause and the way out.- The same variable is read by the API and reported as
docker_in_sandboxonGET /environments/config, which is already public and already the frontend's source for deployment-wide environment facts. - The environment-create dialog and both agent docker toggles are hidden when it is
false, so the setting is not offered where it cannot work.
Refusing before the write also removes the leaked-PVC state: today a failed create leaves its PVC behind and the row at error with no backend_ref, so it can be neither started nor retried.
Verification
services/agent-runner:go build ./...,go vet ./..., fullgo test $(go list ./... | grep -v /test/e2e)pass.services/api: same three gates pass.- New
TestDockerInSandboxDisabled_RefusesBeforeSubmittingAnythingcovers all three entry points and asserts the refusal text plus zero Jobs/Deployments written. - Sabotage check: with the guard stubbed to
return nil, the same test fails with
Start error = sandbox/k8s: no pod matching selector "job-name=paca-sbx-…" got an IP after 1ms … want the docker-in-sandbox refusal (not a readiness failure)— i.e. it submits the workload again, exactly the reported behaviour. - Web:
apps/webhas nonode_moduleshere, so notsc -pand no component test. The four touched files parse underesbuild --loader:.tsx=tsx;biome@2could not install its native CLI in this environment, andbiome@1flags import order on untouched files too, so it is not a usable signal.
Notes
- Enforcement stays in agent-runner, which is the layer that knows the backend; the API field exists so the UI can hide the toggle, not as a second gate. An API-only caller that still sets
docker_enabledgets the same refusal, immediately. - A deployment that wants docker-in-sandbox needs a sandbox namespace whose Pod Security Admission allows privileged Pods — a deliberate, node-level trust decision this change does not make for anyone.
Activity
pullfrog commentedon Oct 21, 2026