ADR 0028 — devcontainer.json is the workspace environment contract ​
- Status: accepted (2026-10-01), an owner decision. Built (2026-10-02, MVP slice 7b): adam-rs builds the environment and the coder uses it (adam-rs ADR 0010,
c0f12dd), and this repository runs it end to end (see the status note). The defaults listed under Defaults the owner may revisit were chosen by the plan, not by the owner. Amended (2026-11-19): the how is removed and the what stands — the environment is a run pod of an image the repository publishes, on Kubernetes only, and nowhere in this stack (status note, adam ADR 0052).
Context ​
The owner asked on 2026-10-01: "Can't we use devcontainers to build work environments?", and then: "Go with 7b after slice 7."
Today a coding agent runs every command in its own container. adam-coder runs run_command, run_checks and OpenCode, and every command OpenCode starts, inside the coder's image, which is another-agentic-images' workspace image plus the coder. One image has to carry the toolchain of every repository it will ever meet, and a repository cannot say what it needs (vision).
The facts below are what the decision rests on. Each is marked.
The specification and the tool (verified 2026-10-01):
- A repository describes its environment in
devcontainer.json, a "JSON with Comments file". A tool looks for.devcontainer/devcontainer.json, then.devcontainer.json, then.devcontainer/<folder>/devcontainer.json, one level deep. An image can carry configuration in adevcontainer.metadatalabel. The propertyinitializeCommandruns on the host machine, during initialization (https://containers.dev/implementors/spec/). - The specification repository is licensed CC-BY-4.0 and MIT (https://github.com/devcontainers/spec).
- The devcontainer CLI is "a reference implementation for the specification that can create and configure a dev container from a devcontainer.json", licensed MIT (https://github.com/devcontainers/cli). The npm package
@devcontainers/cliis at 0.89.0, MIT, with no runtime dependencies (https://registry.npmjs.org/@devcontainers/cli/latest). - envbuilder, Coder's tool that builds a dev container from inside a container on Docker, Kubernetes and OpenShift, says in its README: "
envbuilderis in maintenance mode and no new features are planned, please explore alternative options." (https://github.com/coder/envbuilder)
The default image (verified 2026-10-01):
- vymalo/another-agentic-images#9 ("publish the workspace image as a dev container base") merged on 2026-10-01 as
ee2273e. CI runs@devcontainers/cli@0.89.0against the image. - The tag is
ghcr.io/vymalo/another-agentic-images/workspace:1.98.1-ee2273e, digestsha256:9b2670fc45f50b7b7b8f959fe5caa06e630cba86c0229b2a7d33bee7f26d752a. The registry answered an anonymous pull of the manifest with HTTP 200 on 2026-10-01 (read from the registry for this page). - Its image configuration (linux/amd64, user
agent) carries the labeldevcontainer.metadata=[{"remoteUser":"agent","containerUser":"agent","updateRemoteUserUID":true}], read from the registry on 2026-10-01.
What a rootless Podman service allows (verified 2026-10-01 by running it in the slice 7b planning, with Docker 29.6.2, kernel 6.18, @devcontainers/cli@0.89.0 and quay.io/podman/stable:v5.8.7-immutable; not re-run for this page, and adam's ADR and CI repeat it):
- The CLI builds and starts a devcontainer through the socket of a
podman system servicerun by an unprivileged user (uid 10001), using--docker-path podmanand Podman's remote client. A Dockerfile build, a non-rootremoteUser,postCreateCommand,containerEnvandexecall work this way. - That service itself runs in a container with no
privileged, nocap_addand nodevices. It needs containers/common's seccomp profile instead of Docker's default, andsystempaths=unconfined. Where AppArmor is on, it also needsapparmor=unconfined. - The CLI has no command that removes a container. Killing the
execclient leaves the process it started inside the container running. Podman'srm -fcan report an error and still remove the container.
Unverified, to be checked by the builds of slice 7b:
- Ubuntu 24.04 hosts (CI runners) set
kernel.apparmor_restrict_unprivileged_userns=1, which the service needs off (a secondary source says so). - DNS to compose service names from inside a devcontainer on the service's network.
- podman-remote 5.4.2 from Debian trixie against a Podman 5.8.7 server.
- Whether a Kubernetes cluster's policy lets the Podman service run at all.
What this repository already says. Sandboxes and runtimes are the agent host's concern (ADR 0007, ADR 0003), and sandboxing a local agent is "the agent's responsibility, not the orchestrator's" (ADR 0015). another-agentic-platform is design only (verified 2026-10-01, its CLAUDE.md), and its open questions still ask "What runtime sandbox technology is required?" (docs/architecture/11-decisions.md).
Decision ​
- A repository's
devcontainer.jsonis its work environment. The contract is the containers.dev specification. The coding agent builds and starts the environment with the official devcontainer CLI. Inside it, the agent runsrun_command,run_checks, OpenCode and every command OpenCode starts. The file tools and all git work stay in the agent's own container, because they act on the shared worktree and git holds the credentials. The orchestrator does not know any of this (see Which invariants it touches). - Which repository decides. The first repository of the workspace, in the order its slots joined the run, decides once, for the whole run. A scratch slot counts as a slot. In it the agent looks for the file in the order of the specification above. If there are several in
.devcontainer/<folder>/, the first in sorted order is used, and a step says so.- Later repositories are mounted into the same container. Their own devcontainer is ignored, and a step says which one is used.
- A workspace that starts as scratch work therefore keeps the default environment after a repository joins it.
- The default. A first slot with no devcontainer file gets another-agentic-images'
workspaceimage, published as a dev container (vymalo/another-agentic-images#9). The built-in default is that image, pinned by tag and digest; a deployment can set another (DEVCONTAINER_DEFAULT_IMAGE). The toolchain stays in that image; there is no devcontainer feature that installs it. - The runtime is a rootless Podman service, never the host's Docker socket.
- The agent reaches it over its API socket, through the official CLI.
- The service has no
privileged, nocap_addand nodevices. It is the trust boundary and is trusted like the agent. One service serves one workspace volume, mounted at the same path in both. - A deployment without a service runs with
DEVCONTAINER_RUNTIME=off(the default).
- The file is untrusted input. A repository's
devcontainer.jsoncan run commands. The agent checks it before the build, checks what the features and the image add to it, and checks the created container, which has the last word. Refused:privileged, a capability other thanSYS_PTRACE, a bind mount, a Docker Compose file,runArgsoutside a short list.initializeCommandis removed: the specification runs it on the host side, which here is the agent's container, next to its credentials.${localEnv:…}resolves from a cleared environment. Nothing is published. The environment never gets the GitHub token or App key,DATABASE_URL, the bearer tokens or the thread-tools token. OpenCode's model key arrives as a read-only file, never on a command line. - Nothing happens silently.
- The environment is built in steps shown under the tool call that needed it, nested as in ADR 0025:
Building the environment from .devcontainer/devcontainer.json (local/devbox),Using the default environment (<image>). - A broken file (a parse error, no
imageorbuild, a refused privilege, a failed build or lifecycle command, a timeout) ends the step as failed, naming the file and the problem. The agent asks the person how to go on: fix the file, or continue in the default environment. There is no silent fallback. - No runtime (off, or the service unreachable): the run goes on in the agent's own environment, with a step that says so. If the repository has a devcontainer, the step says the deployment runs without a container runtime. A tool that exists only in the devcontainer is then reported as missing.
- The environment is built in steps shown under the tool call that needed it, nested as in ADR 0025:
- Teardown. When the run ends, the agent's janitor removes the container and the images built for the run, and checks by label that none is left. A restarted agent finds its containers by label. Pulled base images stay cached.
- Kubernetes waits for the platform. On Kubernetes the coder stays
Local: commands run in its own container, the Helm chart keepsDEVCONTAINER_RUNTIME=off, and its README says why. Devcontainers there wait until the platform has a sandbox provider (open question 41).
Done when ​
MVP slice 7b lists what must hold, proven by this system's end-to-end script through the web (AG-UI) and by the agent's own end-to-end test over A2A: a repository with a devcontainer, one without, no runtime, a broken file, teardown, and least privilege.
The sequence ​
sequenceDiagram
actor P as Person
participant W as Web
participant O as Orchestrator
participant C as Coder
participant S as Podman service
P->>W: names a repository
W->>O: AG-UI run
O->>C: A2A message
C->>C: prepare_workspace clones it into the run's slot
C->>C: first command: the first slot decides the environment
C-->>O: step Building the environment (running)
O-->>W: the step, nested under the tool call
C->>C: check the file against the policy
C->>S: devcontainer up (pull or build, create)
S-->>C: container id
C->>S: inspect: check what was created
C->>S: lifecycle commands as the remote user
C-->>O: step completed
O-->>W: step completed
loop run_command, run_checks, OpenCode
C->>S: devcontainer exec
S-->>C: output and exit code
end
C->>C: git commit and push, in the coder
C-->>O: branch and checks artifacts for the pushed commit
O->>O: the gate decides, as today
Note over C,S: the run ends
C->>S: release: remove the container and its imagesThe environment's lifecycle ​
stateDiagram-v2
[*] --> Probing: the first command of the run needs an environment
Probing --> Local: runtime off or unreachable, a step says commands run in the coder
Probing --> Building: runtime ok, read the configuration and run up
Building --> Checking: container created
Checking --> Broken: policy refused, container removed
Checking --> SettingUp: run the lifecycle commands
SettingUp --> Ready
Building --> Broken: configuration or build error, timeout
SettingUp --> Broken: a lifecycle command failed
Ready --> Ready: a command runs, the environment is reused within the run
Ready --> Building: a repository joined, or the container is gone
Broken --> Building: the person asked to rebuild, or the file changed
Ready --> Released: the run ended, the janitor releases it
Broken --> Released
Local --> [*]
Released --> [*]The diagrams leave out how Broken is remembered. A broken environment is cached for the run, so a retry gets the same error at once, until the file changes or the person asks for a rebuild. A rebuild that says "use the default" sets a per-run flag. Joining a repository recreates the container (so that the new mirror is mounted and the lifecycle commands run again); a container lost to a service restart is recreated too, with a step that says so.
Which invariants it touches ​
- Protocols only (ADR 0007). What this adds is a file format and a command line tool: containers.dev is a published specification, and its reference CLI is MIT licensed. The CLI is a dependency of the agent's image, like
gitor OpenCode. The orchestrator depends on neither the CLI nor Podman, and this repository gains no dependency on an agent host, gateway or SDK. - Host conveniences are optional (ADR 0008). This is not an extension, because the orchestrator takes no part. It is a requirement on agents that run commands in a workspace, as vision capability 6 is. An agent that does not do this still works, and plain A2A agents are unaffected. The one thing that may reach the system is an optional
environment {kind, source?, image}field in thechecksartifact. The gate ignores it (verified 2026-10-01:recognise_artifactincore/src/gate.rsatc8cd1f8readspassed,commit,summaryandfindingsand no other key). - Stateless, one event log (ADR 0001), git is the artifact (ADR 0003). An environment is built from the repository's file and is never stored in Postgres. The container and its per-run files are scratch on the coder's workspace volume, beside the worktree, with the worktree's lifetime. A lost container is rebuilt from git, and what a process left inside it is gone: only what was pushed counts.
- Verification over consensus (ADR 0002, ADR 0018). The gate is unchanged. The agent's checks run in the repository's own environment but are still bound to the commit that was pushed.
- The core is pure, protocols are closed enums, implementations are swappable (ADR 0004, ADR 0009). Nothing changes in the orchestrator. In adam-rs the seam is an
Environmenttrait in the workspace crate, withLocal(today's behaviour) built in slice 7 andDevContainerbuilt in slice 7b. The choice is made at build and configuration time (DEVCONTAINER_RUNTIME), not by a plugin.
Consequences ​
- A repository says what it needs, in a file that tools other than ours read, and a missing tool gets an answer that says where to add it (the repository's
.devcontainer/devcontainer.json, or, on the default image, a devcontainer in the repository). - Every coder that uses it needs a rootless Podman service beside it, on the same workspace volume at the same path. Images are stored a second time, the first run of an environment pays for pulling and building, and a host may need a setting (the Ubuntu sysctl above). Where the service cannot run, the agent degrades to the agent's own environment with a visible step, and does not break.
- A new class of untrusted input is accepted from repositories, and the policy above is the control. The residual risk: an escape from a devcontainer lands in the Podman service, which sees every run's workspace and its socket, but holds no GitHub credential. It is not isolation between tenants. Stronger isolation (a service per run, gVisor, the platform's sandbox) comes after the MVP.
- Required elsewhere:
- adam-rs: the
Environmentseam in slice 7, then theadam-devcontainercrate, the coder's tools and its image (the CLI andpodman-remote), and its own ADR (the contract and the full list of defaults). - another-agentic-images: the workspace image as a dev container base (done, #9).
- this repository: the compose override with the Podman service, the fixtures
local/devboxandlocal/devbox-broken, the end-to-end script, anddev/README.md. No orchestrator or web change: the environment appears as nested steps (ADR 0025). - another-agentic-platform: a sandbox provider, before Kubernetes can use devcontainers.
- adam-rs: the
Defaults the owner may revisit ​
The plan built these defaults. The owner may choose differently.
| Topic | Default | Alternative |
|---|---|---|
| A scratch slot comes first | It counts as the first slot, so the run keeps the default environment after a repository joins | Skip scratch slots, and let the first repository decide (rebuilding when it joins) |
| The default image in tests | The local stack and CI use Microsoft's small mcr.microsoft.com/devcontainers/base image; production uses the workspace image. The real image is tested nightly or by hand | Test with the workspace image every time, at several gigabytes more per runner |
Compose-based devcontainers (dockerComposeFile) | Refused, with a clear error | docker compose against the Podman socket: needs the compose CLI in the coder and the policy on every service |
| Privileges | capAdd only SYS_PTRACE; securityOpt only seccomp=unconfined and label=disable, both under the service's own filter. privileged, other capabilities and host binds refused, so no Docker-in-Docker | Refuse those too, which breaks the official rust, go and cpp features |
| A repository joins the run | Recreate the container, so the new mirror is mounted and lifecycle commands run again | No restart, and no git inside the slot that joined late |
| A broken file | An error, and the person decides | Fall back to the default image on its own, with a warning step |
| The container's network | The service's own network, which the deployment limits (inherit) | none, which needs a per-run model proxy in the coder before OpenCode can work |
| No runtime | Run in the agent's own environment, with a visible step | Fail closed when the repository declares a devcontainer |
Alternatives rejected ​
- envbuilder. It builds a dev container from inside a container, and its README says it is in maintenance mode with no new features planned (verified 2026-10-01). The official CLI is the reference implementation of the same specification.
- The host's Docker socket. It hands the coder control of the host's containers, beside the credentials the coder holds. A rootless Podman service keeps the blast radius inside that service.
- A privileged or Docker-in-Docker service. Not needed: the nested run works with the settings above (verified 2026-10-01 by running, see Context).
- One image with every toolchain, as today. It cannot know a repository's needs, and every change to a toolchain is a new image for every repository.
- A toolchain devcontainer feature in another-agentic-images. It would be a new package on the registry, private until the owner flips it. The install script assumes Debian, amd64 and one user, and gigabytes of toolchain in every build defeat a repository-specific environment. The one tool the agent needs inside, OpenCode, is mounted from the agent. A small
opencodefeature can come later if images based on musl matter. - A silent fallback when the file is broken. The person would not know that the checks ran in another environment than the repository declared.
- Devcontainers on Kubernetes now. They need a sandbox provider that the platform does not have yet (open question 41).
Status note, 2026-10-02: built, the stack and its scenario ​
Marker, 2026-11-19: every path this note names under
dev/and.github/— the override, the vendored service, the scenario, its workflow step and its compose checks — was removed with the Podman path (epic #359 slice 12, #372; adam ADR 0052). What the note says about the decision and its proof stands as history; the note of 2026-11-19 says what is true now.
The contract is built on both sides. adam-rs (pinned in compose.yaml at c0f12dd, which contains its #67 and #68): the adam-devcontainer crate and its ADR 0010 (how adam-rs does it: the policy checked three times, the override file, the teardown), the coder's tools routed through the environment, OpenCode inside it, the rebuild_environment tool, the environment {kind, source?, image} of the checks artifact, and the fixtures local/devbox and local/devbox-broken. This repository (MVP slice 7b; no orchestrator or web change, as decided above):
dev/compose.devcontainer.yaml: an override that adds a rootless Podman service and points the coder at it (DEVCONTAINER_RUNTIME=podman, the same workspace volume at the same path, a socket shared with the coder only). The service is built fromdev/coder/podman/, vendored byte for byte from adam-rsdev/podmanatc0f12ddand covered bydev/coder/check-vendored.sh. It has noprivileged, nocap_addand nodevices, and no Docker socket is mounted anywhere; its threesecurity_optentries (a pinned seccomp profile file,systempaths=unconfined,apparmor=unconfined) and why each is needed are indev/coder/podman/README.mdanddev/README.md's "Devcontainers" section (both removed 2026-11-19: see the note below). The base stack does not change: without the override the coder runs with the runtime off, in its own container. The override also makesmock-ciwatchlocal/devbox, because the coder's gate waits for CI on the pushed commit.dev/devcontainer-e2e.sh: through the web's own path (AG-UI), the done-when items of MVP slice 7b: the devcontainer oflocal/devboxis the environment (the step Building the environment from .devcontainer/devcontainer.json completes,devbox-toolis found, the gate is green,envinside holds no secret);local/sandboxruns in the default image (Using the default environment, the probe printsdevcontainer-env); with the service stopped the run goes on in the coder's own container, a step says so anddevbox-toolis a missing tool; the brokenlocal/devbox-brokenis a failed step that namesprivileged, the person decides, and/work/INIT-RANdoes not exist; after the run Podman lists no container with its label; the service has noprivileged,cap_addordevices..github/workflows/coder-e2e.ymlruns it on every run, after settingkernel.apparmor_restrict_unprivileged_userns=0where the key exists, with the small MCR base image as the default environment (the owner's default for the "default image in tests" row above).compose.ymlchecks the override's privileges on every pull request without starting anything.
What is verified and what is not: verified 2026-10-02 by reading adam-rs at c0f12dd (the service, its README, its ADR, its compose override and its own end-to-end script; the workflow of that repository pushes the image of a commit, and bumps its chart to it, only after its compose end to end, which runs those scenarios, passed, and 6dd238f is that bump for c0f12dd) and by running docker compose config (with the base file, and with the GitHub App and live overrides), shellcheck, the drift check and the scripts' jq on samples. Not run where this was written (no container could be started): the scenario itself, and with it the items below, which the Coder E2E job of the pull request that built this is the proof of. The facts adam-rs's CI settled under Unverified above (the podman-remote client, the user-namespace ids) are in adam-rs's ADR 0010 status notes.
- Still unverified until that job runs here: that the GitHub runners' AppArmor setting is the one to turn off (it is set only where the key exists), that the coder's gate (
ci+agent_checkswithmock-ci) completes for a repository whose work was done in a container, and that DNS tomock-openaiand the pulls work from a nested container on the runners. - Kubernetes is unchanged: the coder stays
Localthere (open question 41).
Status note, 2026-11-19: the how is removed, the contract stays ​
The owner decided on 2026-11-19 to remove Podman from adam-rs and from the stack around it, as a hard cutover (adam ADR 0052, accepted 2026-11-19, merged as vymalo/another-adam-rs#194). This note records what that does to this decision. The decision above is not rewritten: the dated notes before it say what was built and checked, and this one says what is true after the removal. The 2026-10-02 note carries its own marker for the paths this slice deletes, and the one link in it that pointed at the "Devcontainers" section points here.
The what is unchanged. Decision 1 stands: a repository's .devcontainer/devcontainer.json is the contract of its work environment — the containers.dev specification, the file read in the order the specification gives, the first repository of a workspace deciding, the untrusted-input policy (a refused privilege, no silent fallback, the person decides), and nothing of it in the orchestrator. The workspace image of another-agentic-images stays the default base a repository can name, and the orchestrator and the web still change nothing.
The how is being removed. Decision 4 (the devcontainer CLI run against a rootless Podman service beside the coder, the service as the trust boundary) and decision 8's "Kubernetes waits" no longer describe anything that runs once adam ADR 0052's slices land. In adam-rs the adam-devcontainer crate, the ten DEVCONTAINER_* and CONTAINER_HOST settings, rebuild_environment and the CLI and remote client in the image go with its slices 2 and 3 (nothing of them is built yet: the pin this stack runs still carries the path). In this repository, epic #359 slice 12 (#372, numbered slice 6 when it was claimed, adam ADR 0052 slice 4) removed the dev stack's half: dev/compose.devcontainer.yaml, the vendored dev/coder/podman/, dev/devcontainer-e2e.sh, its step in .github/workflows/coder-e2e.yml, its compose checks, dev/README.md's "Devcontainers" section, and the entries of dev/coder/UPSTREAM and dev/coder/check-vendored.sh. Nothing of it was left dormant or behind a flag.
The how is adam ADR 0052. A repository's own environment is a run pod of an image the repository publishes: on Kubernetes, when the deployment allows the image's prefix, the coder offers use_repository_environment and the run's commands run in that pod (adam-rs slice 1, not this repository). On a desktop and in this development stack the tool does not appear at all: commands run where the coder runs, and one step says the repository's configuration is not used. No container engine runs at run time, so the service's least-privilege table, its seccomp and AppArmor settings, the socket volume and the "an escape lands in the service" residual risk are history, not current guarantees. Where the file cannot be honoured (a desktop, this stack, a deployment without an allowed image), the contract is still read and the answer still says so; what a repository gets there is the coder's own environment, never a silent fallback.
What this does not decide. Whether a cluster deployment may build an image from a repository (it may not: the repository's CI publishes it), how a repository names its image in devcontainer.json (not here: adam ADR 0052 decision 6 decides it — customizations.adam.image, or a plain image; a build is refused in words), and the platform's gVisor class for run pods (another-agentic-platform, AD-052). Question 41 keeps its own record in docs/open-questions.md.
Verified 2026-11-19: the paths above are gone from this repository and git grep -i podman -- dev .github is empty; the compose files and the base and live overrides still parse, and the docs check passes. Adam ADR 0052 was read at its merged file: it records that nothing of adam's side is built yet (its slices are the epic's adam tickets), so no test of it exists and none is claimed here; this note has not read the code that ADR describes.