Skip to content

feat(roadmap): run the implement agent shell in a real sandbox #2695

Done
5 of 5 issues completed
Done

Description

@dan-petty

Summary

Keep the App key out of each container that runs the agent. One runner Job pod runs three containers, one after the other: prepare, agent and publish. The owner chose this design on 2026-11-20 (comment 7045868447). It replaces the design of 2026-11-05 (comments 6662676867 and 6667773105).

This item is the parent. The split items hold the work. The section Split gives their order.

Problem

  • The App key and the agent share one pod and one process tree. The runner Job (k8s/devops/cronjob-runner.yaml) has one container. It loads the App private key and the model key (fix(k8s): load only the needed Secret keys in runner Jobs #6518). The implement Job and the fix-checks Job run the agent shell in that container. The shell runs as the same user as the job code that mints App tokens.
  • The boundary is a set of guards in the job code. OriginGit runs each git call that holds the token in an isolated git folder. check_settings reads the git settings of the clone (src/devops_cli/roadmap/implement/git_isolation.py). end_leftover_processes ends the processes that a step leaves. deny_environment_reads stops a child from reading /proc/1/environ. Each code path that holds a key must call each guard. The fix-checks Job did not call deny_environment_reads until fix(roadmap): harden the fix-checks Job process as implement does #6540 (advisory GHSA-jvhh-jjjr-5mxf, release 0.183.2).
  • The stage Job pushes with plain git from the agent tree (_push in src/devops_cli/roadmap/stage/stage.py). This is safe only while stage has no shell. refactor(roadmap): run stage on Coder in the runner image #6528 gives stage a shell.
  • The workflows chain. Each runner token asks for workflows: write (CONST_GITHUB_APP_TOKEN_PERMISSIONS, fix(roadmap): the App token can push a workflow file #3519). So a pushed branch can add or change a workflow that runs on push, before a person reads it. The release key is only in the environment release, which allows only main, so a branch workflow cannot read that key.

Design

Use a sequential split in one Job pod (option A).

Container Kind Secret key What it does
prepare init container 1 App private key It reads the item and the plan, does the claim and the status, and makes an anonymous clone. It records the base SHA and the item state in a folder that the agent does not mount. It runs only git and GitHub API calls.
agent init container 2 model key only It runs stock Coder on LocalWorkspace with its shell (#6527). It writes a patch, a summary and an outcome to a shared emptyDir. It makes no GitHub call.
publish app container App private key It starts only after the agent container exits. It reads the patch as data and applies it to a new bare clone at the recorded base. It writes its own commit, mints a narrowed token, pushes and opens a draft PR.

The reasons:

  • Kubernetes runs the init containers one after the other, each to completion, before the app container starts. When PID 1 of the agent container exits, the kernel ends each process that the agent left. So no agent process is alive while a container holds the App key.
  • It fits stock Coder. It needs no command server, no WorkspaceBackend of this project and no file import.
  • Comparable products give the output of the agent as data to a step that holds the credential. Examples are the safe outputs of GitHub Agentic Workflows, Codex cloud and the Copilot cloud agent.
  • The fix-checks Job and the stage Job (refactor(roadmap): run stage on Coder in the runner image #6528) use the same template and the same publish step.

Decided rules:

  • workflows: write. publish asks for it only when the merged plan of the item names a workflow file. prepare reads the plan from main, where the agent cannot change it.
  • Model key. Runner Jobs keep the current model key for now. The agent container holds it, and deny_environment_reads stays in the agent phase. This key is the gateway master key, so it stays a known risk.

Options compared

Criterion A: sequential split (chosen) B: command server (design of 2026-11-05) C: separate publish Job, or the Service publishes
App key next to a live agent process Never Yes, in the job container for the full run Never with a separate Job. If the Service publishes, its process with the most rights parses agent data.
Race on shared files None. No agent process is alive when publish reads. Yes. The file import runs while shell processes are alive. None
Custom code Phase flag, publish step, policy rules. Implement loses code. sandboxd adapter, a WorkspaceBackend, file import, policy The code of A, plus a transport between Jobs and its cleanup
Fit with stock Coder Exact A custom backend. #6527 deletes the allowlist that B carries. Exact

Requirements that no longer apply

These requirements of the design of 2026-11-05 do not apply now:

Split

Do the split items in this order. Each item is one pull request.

  1. feat(roadmap): run implement and fix-checks as prepare/agent/publish phases #3702: run implement and fix-checks as the phases prepare, agent and publish. --phase all keeps the current one-container template working.
  2. feat(roadmap): add the three-container runner Job, policy and log reads #3700: the three-container runner template, the admission policy and the Job readers of the Service. It is blocked by feat(roadmap): run implement and fix-checks as prepare/agent/publish phases #3702 and by the runner image release that holds feat(roadmap): run implement and fix-checks as prepare/agent/publish phases #3702.

#3694 (the sandboxd command server) is closed as not planned. #5431 and #5434 (the gVisor RuntimeClass and its measurement) are done.

Each blocker that the critic of the design study found is an acceptance criterion of one split item:

Blocker Item
prepare runs no code from the tree. #3702
deny_environment_reads runs first in each phase. #3702
The base of a Staged item is on GitHub before publish fetches it. #3702
The agent phase writes the PR body text, and publish checks it. #3702
publish refuses a new or changed symlink or gitlink. #3702
The Service reads the Job log and the container status by container name. #3700
Each per-container policy rule also checks the init containers, and the policy refuses a container-level restartPolicy. #3700

Acceptance criteria

Key questions

  1. Where the implement Job ends. In the split, publish ends the implement Job at "draft PR opened". The Service watch row then marks the PR ready and starts the fix-checks Jobs. The WIP pushes and the in-Job loop that watches, fixes and marks ready can then go. An OOM kill or a deadline kill of the agent container then loses the work of that run. The implement grade must follow the PR across the fix-checks Jobs, and some check classes lose their repair. feat(roadmap): add the three-container runner Job, policy and log reads #3700 makes the split live, so feat(roadmap): add the three-container runner Job, policy and log reads #3700 needs this answer before it merges. Do you accept that the implement Job ends at "draft PR opened"?
  2. One approval on App PRs. The ruleset of main needs no approval, and auto-merge is on. So a token with contents and pull-request write can merge a PR after the checks pass. Only the owner changes this repository setting. Do you want to require one approval on the PRs that the App opens?
  3. gVisor as a later layer. The split keeps the App key away from the agent without gVisor. feat(k8s): a gVisor RuntimeClass for pods that run untrusted code #5431 added the RuntimeClass gvisor, and feat(k8s): measure runsc against runc for RuntimeClass gvisor #5434 measured it. Can this work ship without gVisor, and a later item add runtimeClassName: gvisor to the whole runner pod?

Cost

This is an estimate, not a measurement. The critic of the design study gives these values for the full work:

  • about 2-3k changed lines
  • 25-40 M input tokens and 150-300 k output tokens
  • 2.5-4 days

The first estimate of the study was 0.9-1.2k lines and 13-22 M input tokens. That estimate did not include these parts:

  • the Service readers
  • the state between the phases
  • the reads from git objects in publish
  • the Staged base
  • the policy rules for the init containers
  • the grade change

Existing tool considered

  • Kubernetes init containers give the order and a Secret per container.
  • Git plumbing applies the patch: read-tree, apply --cached, write-tree and commit-tree.
  • Stock Coder and LocalWorkspace of pydantic-ai-harness run the agent, as the gh-aw engine of pydantic does (https://pydantic.dev/docs/ai/harness/gh-aw/).
  • The harness SSHWorkspace is the stock fallback if a concurrent split is necessary later.
  • The harness KubernetesSandbox needs the agent-sandbox controller and the right to create SandboxClaims. A runner Job gets no write RBAC, so it does not apply.

Related

Alternatives check of 2026-11-18: partly.
Tool: kubernetes-sigs/agent-sandbox (https://github.com/kubernetes-sigs/agent-sandbox), Apache-2.0, last activity 2026-11-17, maintained.
Reason: Search results led to kubernetes-sigs/agent-sandbox, whose sandboxd daemon serves commands in a co-located container with root-dir path confinement, so it covers the command server only, not the allowlist, limits, import or Job template.

Covers:

  • Command server for a co-located container over pod-local localhost
  • Commands run with the shell container's user and image
  • Path confinement to a root directory with symlink evaluation
  • Serves the split item's first step: test sandboxd before writing a server

Lacks:

  • No pinned image; upstream example uses a latest-main tag
  • No first-word command allowlist at the process edge
  • No command time or output limits
  • Unconfirmed whether it runs outside a Sandbox resource
  • No artifact import, Job template, admission policy or job-side git hardening

Proposed design

Problem statement

The implement job runs the agent shell in the same pod and user as the GitHub token. The shell can write a git hook, a .git/config value or a changed uv.lock that a later git or uv process runs with the token. The change runs the shell in a second container with no token, under a gVisor RuntimeClass. The job imports the shell files as untrusted input. The job also hardens its own git and uv calls. The work waits on #5431 and #5434 before the runner Job uses the gVisor RuntimeClass.

Acceptance criteria

Requirement: Shell container isolation

The implement Job MUST run the agent shell in a second container as user 1001 with its own worktree and no token.

Scenario: Shell container has no token

  • WHEN The shell container starts.
  • THEN Its environment has no GitHub token, no DEVOPS_CLI_SERVICE_GITHUB_APP_PRIVATE_KEY and no DEVOPS_CLI_AI_API_KEY. It has no Secret envFrom. Its security context sets runAsUser 1001, readOnlyRootFilesystem true, allowPrivilegeEscalation false, seccompProfile RuntimeDefault and capabilities drop ALL. The shell worktree is a directory on the shared emptyDir volume.

Requirement: gVisor RuntimeClass

The runner Job MUST set runtimeClassName gvisor after #5434 measures runsc as usable on the runner image.

Scenario: Runner Job uses gVisor

Requirement: Job-side command allowlist

The job MUST reject a shell command whose first word is not in the allowlist.

Scenario: Disallowed command rejected

  • WHEN The agent requests a command whose first word is not in the allowlist.
  • THEN The job returns an error. It sends no command to the shell container.

Requirement: Command time and output limits

The job MUST stop a shell command that exceeds its time limit or its output limit.

Scenario: Output limit stops command

  • WHEN A shell command writes more output than the output limit.
  • THEN The job stops the command. It masks the excess output. It reports the output limit as the reason.

Requirement: Artifact import security

The job MUST import the shell worktree as untrusted files and skip .git, symbolic links and out-of-path files.

Scenario: Symbolic link refused

  • WHEN The shell worktree contains a symbolic link.
  • THEN The import step rejects the file. It does not follow the link.

Requirement: WorkspaceBackend routing

The implement job MUST run agent shell commands through a pydantic-ai WorkspaceBackend.

Scenario: Step command routed to shell container

  • WHEN An agent step issues a shell command.
  • THEN The command server in the shell container receives the command. The job container does not run it.

Requirement: Job git isolation

The job MUST run its own git with core.hooksPath=/dev/null, MUST ignore the shell worktree's git settings and MUST run uv with --no-config.

Scenario: Hook not executed

  • WHEN The shell container writes a git hook into the shell worktree.
  • THEN The job's git does not run that hook.

Requirement: Admission policy permits the shell container and gVisor

The Service admission policy SHALL permit a runner Job with the job container, the shell container, the worktree directory on the shared home emptyDir and runtimeClassName gvisor.

Scenario: Two-container Job with gVisor admitted

  • WHEN A runner Job with the job container, the shell container, the worktree directory on the home emptyDir and runtimeClassName gvisor is submitted.
  • THEN The policy admits it. The policy still rejects a Job with an unpinned image. The policy still rejects a shell container with a Secret envFrom. The policy still rejects a runtimeClassName other than gvisor.

Existing Tool Considered

vstorm-co/pydantic-ai-backend (MIT, maintained, https://github.com/vstorm-co/pydantic-ai-backend) covers the pydantic-ai WorkspaceBackend and a Kubernetes-pod-backed workspace. It lacks the two-container single-Job-pod layout. It lacks the artifact import. It lacks a way to attach the sandbox without a cluster credential. It does not state that the first-word allowlist and the time and output limits hold at the process edge. It lacks the job-side git hardening. The item keeps only the WorkspaceBackend interface. The gVisor RuntimeClass is a cluster feature, not a library. The fallback builds a command server, a WorkspaceBackend adapter, a two-container Job template and an artifact import. The written cost is about 20 to 30 M input tokens, 100 to 200 k output tokens, and about one day. The upkeep is a small adapter and a version pin. With sandboxd the build is about one third less.

Key questions

  • Which sandbox approach separates the agent shell from the job's token?: Use two containers in one Job pod. Run the pod under the gVisor RuntimeClass that feat(k8s): measure runsc against runc for RuntimeClass gvisor #5434 measures. The shell container runs as user 1001. It has no token and no Secret envFrom. It sets readOnlyRootFilesystem true, allowPrivilegeEscalation false, seccompProfile RuntimeDefault and capabilities drop ALL. The containers share one emptyDir volume. The shell works in its own directory. The job keeps its own checkout in another directory. The job imports the shell files. The job runs git and uv only in its own checkout. The owner decided on 2026-11-13 to proceed with gVisor. That decision replaces the rejection of 2026-11-05. (best practice) [sources: k8s/devops/cronjob-runner.yaml:33, k8s/devops/cronjob-runner.yaml:36, k8s/devops/cronjob-runner.yaml:39, k8s/devops/cronjob-runner.yaml:47, k8s/devops/cronjob-runner.yaml:48, k8s/devops/cronjob-runner.yaml:50, k8s/devops/roadmap-service/admissionpolicy.yaml:41, docs/CLUSTER.md:65, openspec/specs/roadmap-implement-runner/spec.md:4]
    • Chosen: Two containers in one Job pod under gVisor RuntimeClass. A different user in a different container is a real boundary for the token. gVisor adds host-kernel isolation. Pod Security restricted allows it. It needs the RuntimeClass from feat(k8s): a gVisor RuntimeClass for pods that run untrusted code #5431 and the feat(k8s): measure runsc against runc for RuntimeClass gvisor #5434 measurement.
    • Rejected: gVisor alone without a second container. It isolates the pod from the host kernel. It does not separate the shell from the token in the same user and filesystem.
    • Rejected: One Job per step with a read-write worktree volume. A pod start for each step costs seconds and an image pull check for each step. It still needs the artifact import.
    • Rejected: User namespace with bubblewrap or unshare. The default seccomp profile refuses CLONE_NEWUSER without CAP_SYS_ADMIN. Pod Security restricted forbids seccomp=unconfined.
  • How does the job communicate with the shell container?: The shell container exposes a command server on localhost. The job reaches it through a pydantic-ai WorkspaceBackend. The backend implements SupportsCommands and SupportsFilesystem. The job enforces the first-word allowlist before it sends a command. The job enforces the time and output limits around the call. The job holds no Kubernetes API credential. (best practice) [sources: src/devops_cli/roadmap/implement/implement_step.py:571, src/devops_cli/roadmap/implement/implement_step.py:576, k8s/devops/cronjob-runner.yaml:33, docs/CLUSTER.md:65, tests/roadmap/implement/test_roadmap_implement_shell_policy.py:15]
    • Chosen: Localhost command server behind a pydantic-ai WorkspaceBackend. It reuses the pydantic-ai agent interface. It keeps the Kubernetes credential out of the job.
    • Rejected: Direct exec into the shell container through the Kubernetes API. It requires a Kubernetes token in the job. That adds a new credential to the token-holding trust zone.
    • Rejected: pydantic-ai-backend KubernetesWorkspace. It uses pods/exec and needs pods/exec RBAC on the namespace. The runner pod sets automountServiceAccountToken false and has no API-server egress.
  • Should kubernetes-sigs/agent-sandbox be adopted for this item?: Do not adopt its controller and CRDs. Keep the two-container layout under gVisor. The runner pod mounts no Kubernetes token. The admission policy admits only the volumes tmp, home and config. A controller that reads Sandbox status does not fit. A worktree that crosses pods does not fit. In the first split item, test the sandboxd daemon as the command server. Do this before you write a server. Adopt sandboxd only if it runs outside a Sandbox resource. It must confine each path to the worktree root. It must have a pinned image. Keep the first-word allowlist on the job side. Enforce the time and output limits around the call. (best practice) [sources: AGENTS.md:11, k8s/devops/cronjob-runner.yaml:33, k8s/devops/roadmap-service/admissionpolicy.yaml:80, openspec/specs/roadmap-implement-runner/spec.md:4, docs/CLUSTER.md:65]
    • Chosen: Test sandboxd first and keep the two-container layout under gVisor. AGENTS.md:11 requires an open tool before the project builds its own. The test is bounded. The allowlist and limits stay on the job side. The daemon is not adopted until it runs outside a Sandbox resource with a pinned image.
    • Rejected: Adopt the agent-sandbox controller and CRDs. The controller adds no isolation by itself. It needs a Kubernetes credential, which the runner pod does not hold. The worktree would cross pods.
    • Rejected: Write the small server without testing sandboxd. An open, maintained tool may cover the command path. The project should test it before it builds and keeps its own server.
  • How does the job import the shell work without trusting it?: The job copies the working files from the shell directory into its own checkout. The checkout is on the shared volume. It skips .git. It resolves each path through safe_resolve_subpath against the shell worktree root with allow_symlinks=False. A symbolic link, a .. escape or an absolute path outside the root is refused. It refuses files outside the group's paths. It then runs its checks, commits and pushes from its own tree. The job never imports the shell's .git. (best practice) [sources: src/devops_cli/core/paths.py:35, src/devops_cli/core/paths.py:81, src/devops_cli/core/paths.py:87, ARCHITECTURE.md:218, SECURITY.md:32, src/devops_cli/roadmap/implement/implement_strays.py:1, src/devops_cli/roadmap/implement/git_isolation.py:1]
    • Chosen: Copy working files, skip .git, refuse symlinks and out-of-path files through safe_resolve_subpath. The job owns the repository metadata. It never reads a git setting that the shell wrote. The existing helper refuses a symbolic link and a .. escape from the root.
    • Rejected: Share the full worktree including .git. The shell could write hooks or config that the job's git would run with the token. This is the attack the sandbox prevents.
    • Rejected: Copy the tree with shutil.copytree and follow symbolic links. A symbolic link to a file outside the shell worktree would be copied as its target. The job would import a file the shell did not create. safe_resolve_subpath refuses the link instead.
  • Is the cheap step (core.hooksPath=/dev/null, uv --no-config) a sufficient fix?: No. It mitigates the hook and config attack vector. It does not separate the shell from the token. The shell still runs as the same user. It can read the token from /proc or the environment. Use the two-container sandbox under gVisor. Keep the cheap step as defense in depth. (best practice) [sources: k8s/devops/cronjob-runner.yaml:4, src/devops_cli/roadmap/implement/git_isolation.py:5, src/devops_cli/config/constants.py:1211, src/devops_cli/commands/install_tools.py:288, k8s/devops/cronjob-runner.yaml:52]
    • Chosen: Two-container sandbox under gVisor plus the cheap step as hardening. It separates the shell from the token by user, filesystem and process tree. gVisor adds host-kernel isolation. The cheap step protects the job's own git and uv calls.
    • Rejected: Cheap step only. The shell still shares the user and filesystem with the token-holding process. It can read the token from /proc or the environment.
  • Does the Service admission policy allow a two-container runner Job with the gVisor RuntimeClass?: No. The policy refuses a Job of the Service with more than one container. It refuses an init container. It refuses other volumes. It does not admit the gVisor RuntimeClass. The second split item must change k8s/devops/roadmap-service/admissionpolicy.yaml. The new policy must permit the shell container and the worktree directory on the shared home emptyDir. It must permit runtimeClassName gvisor. It must still pin the image, account, secrets, volumes and host. It must refuse a shell container with a Secret envFrom or valueFrom. (best practice) [sources: k8s/devops/roadmap-service/admissionpolicy.yaml:41, k8s/devops/roadmap-service/admissionpolicy.yaml:42, k8s/devops/roadmap-service/admissionpolicy.yaml:65, k8s/devops/roadmap-service/admissionpolicy.yaml:73, k8s/devops/roadmap-service/admissionpolicy.yaml:80, k8s/devops/roadmap-service/admissionpolicy.yaml:81]
    • Chosen: Change the policy to permit the two-container Job and runtimeClassName gvisor. The policy must admit the chosen layout. It must still pin the image, account, secrets, volumes and host. It must refuse a shell container with a Secret envFrom or valueFrom.
    • Rejected: Keep the policy and use one container. One container cannot separate the shell from the token.
    • Rejected: Use a separate Job per step. It adds pod start cost and still needs the artifact import.
  • Does vstorm-co/pydantic-ai-backend cover the chosen two-container layout without a cluster credential?: No. Its KubernetesWorkspace runs commands through pods/exec. It needs pods/exec RBAC on the namespace. The runner pod sets automountServiceAccountToken false. It has no API-server egress. The package has no artifact import. It has no job-side git hardening. It is partly useful for the WorkspaceBackend interface. It does not cover the chosen transport. Keep the item with this reason. (best practice) [sources: k8s/devops/cronjob-runner.yaml:33, docs/CLUSTER.md:65]
    • Chosen: Keep the item and use only the WorkspaceBackend interface. The package covers the pydantic-ai WorkspaceBackend. It does not cover the chosen transport, the artifact import or the job-side hardening.
    • Rejected: Adopt KubernetesWorkspace. It needs a cluster credential and pods/exec RBAC. The runner pod has no Kubernetes token and no API-server egress.
  • Does the item fit in one pull request?: No. Split the item into three sequential items. Each item fits one pull request. The first item evaluates sandboxd and adds the command server and the WorkspaceBackend adapter. The second item adds the two-container Job template under the gVisor RuntimeClass, the artifact import and the admission policy change. The third item routes the implement steps through the backend. It also updates the guarantee text. (best practice) [sources: CONTEXT.md:36, AGENTS.md:9]
    • Chosen: Split into three sequential items. The command server, the Job template and the job integration are each substantial changes. The dependency chain keeps each pull request reviewable.
    • Rejected: Deliver as one large pull request. The change is too large for one pull request. It mixes process-edge code, Kubernetes policy and job integration.
  • Should the runner Job send HTTPS through an SNI allowlist proxy in this item?: No. Do not add the egress proxy to this item. File it as a separate issue with its own host list and acceptance criteria. The item's boundary is the two-container shell isolation under gVisor. The egress change affects every runner Job. It also needs the owner's acceptance, which feat(roadmap): track the shared command gate #5199 has not recorded. (best practice) [sources: k8s/devops/networkpolicy.yaml:56, k8s/devops/networkpolicy.yaml:60, k8s/devops/networkpolicy.yaml:71, docs/CLUSTER.md:65, CONTEXT.md:36, AGENTS.md:9]
    • Chosen: Defer the egress proxy to its own issue. It changes the network of every runner Job. It needs its own host list and acceptance criteria. The item already splits into three pull requests. The owner has not accepted the egress part in feat(roadmap): track the shared command gate #5199.
    • Rejected: Add the egress proxy to this item. It mixes a cluster-wide network change with the shell isolation. A missing host makes a Job fail until the list gets that host. It has no acceptance in this item.

Fit

Needs splitting into 3 items:

  1. feat(roadmap): test sandboxd and add the shell command backend #3694: test sandboxd as the command server, and add the shell command backend.
  2. feat(roadmap): add the three-container runner Job, policy and log reads #3700: add the two-container runner Job under the gVisor RuntimeClass, the user and volume layout, the file import, and the admission policy change. Blocked by feat(roadmap): test sandboxd and add the shell command backend #3694 and feat(k8s): measure runsc against runc for RuntimeClass gvisor #5434.
  3. feat(roadmap): run implement and fix-checks as prepare/agent/publish phases #3702: route the implement steps through the shell backend, and update the guarantee text. Blocked by feat(roadmap): add the three-container runner Job, policy and log reads #3700.

Suspected block

None.

Dependencies

None.

Sub-issues

Sub-issues

5 of 5 Issues completed
Loading 5 sub-issues

Activity

  1. added
    source/agent
    type/security
    status/new
    value/medium
    effort/high
    on Oct 29, 2026
  2. dan-petty commented on Oct 29, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/security. The candidate isolates the agent shell from the token to prevent credential leakage to child processes.
    • Priority: P2-Medium. The token is scoped to one repository and lasts one hour, so the risk is real but bounded.
    • Value: Medium. It removes a token-leakage path to git hooks and uv, but the blast radius is already small.
    • Effort: High. Three candidate designs need measurement and cluster support, plus a cheaper mitigation step.
    • Related: feat(k8s): the implement job runs as a cluster Job on a runner image with uv, the dev dependencies and the pinned tools, submitted by the Service #2667, which asks for a different change. Both concern the implement runner Job, but #2667 creates the Job infrastructure and the candidate adds a sandbox boundary for the agent shell inside it.
  3. added
    priority/p2-medium
    on Oct 29, 2026
  4. dan-petty commented on Oct 30, 2026

    @dan-petty
    OwnerAuthor

    Decision for this item, 2026-10-30, with the evidence from #2667 and the code on main.

    The cheap step is not a fix. The job and the agent shell run as one user in one pod. Any file that the job's git reads (a hook, .git/config, a uv setting), the shell can write. Options such as core.hooksPath=/dev/null do not remove the other keys that run a program from a repository config (core.fsmonitor, core.sshCommand, credential.helper, alias.*, filter.*, diff.external). A separate bare repository for the job does not help either, because the same user can write its path. Only a different user in a different container, or a different runtime, is a boundary.

    Chosen design: privilege separation by container (option 1).

    • The Job pod has two containers. The job container keeps the token, the gateway key and the Kubernetes-free environment, and runs git, gh and the model loop. The shell container runs as another user (runAsUser 1001, readOnlyRootFilesystem, all capabilities dropped, no token, no Secret envFrom). It holds the toolchain (uv, ruff, mypy, git for status only).
    • The two containers share one emptyDir for the worktree. The job container owns the repository metadata; the shell container gets the working files only. Pod Security restricted allows both users.
    • The agent's shell tool runs its commands in the shell container through a small command server on localhost, behind a WorkspaceBackend of pydantic-ai (SupportsCommands, SupportsFilesystem). The server executes the same first-word allowlist and the same time and output limits.
    • The job imports the result as an untrusted artifact: it copies the working files into its own checkout, skips .git and refuses symbolic links and files outside the group's paths, then runs its checks, commits and pushes from its own tree. The job never reads a git setting that the shell container wrote.

    Rejected, with the reason

    • One Job per step (option 2): a pod start per step costs seconds and an image pull check for each of many steps, and it still needs the artifact import.
    • gVisor or Kata (option 3): needs a RuntimeClass that a person provides. Adopt it as an extra layer if the cluster ever offers one.
    • bubblewrap and unshare: user namespaces fail under the default seccomp profile, which Pod Security restricted requires (evidence on this issue).

    This item is too big for one pull request. It needs these items, each depending on the one before it:

    1. The command server and the pydantic-ai WorkspaceBackend over localhost, with tests at the process edge.
    2. The two-container Job template, the user and volume layout, and the artifact import in the job.
    3. The implement job runs its steps through the backend, and the guarantee text in design.md and k8s/README.md changes to what the layout provides.

    Label needs-split is set so that refine proposes the split.

  5. added
    needs-split
    type/feature
    scope/roadmap
    and removed
    type/security
    on Oct 30, 2026
  6. devops-cli-service commented on Oct 30, 2026

    @devops-cli-service
    Contributor

    Refine cannot set this item to Ready at 46fd02d until a person answers the questions below. Reply in a comment or edit the body, and the next refine round looks at the item again.

    • Is the cheap step (core.hooksPath=/dev/null, uv --no-config) a sufficient fix? (missing verified source)
  7. dan-petty commented on Nov 1, 2026

    @dan-petty
    OwnerAuthor

    New candidate for design 3 of this issue: kubernetes-sigs/agent-sandbox, a Kubernetes SIG Apps controller. It runs untrusted code from a model in an isolated sandbox (gVisor or Kata) and offers warm pools and claims. The API is v1beta1 and the project is young (v0.5.x), so measure it before a choice.

    A second reason to choose a real sandbox boundary: the shell policy of the runner refuses commands that the agent needs (git diff | head, rm of its own scratch file, redirects), and a refusal makes the agent lose steps or stop (#3072 widens the table by hand). If the sandbox is the boundary, the policy can allow more programs and stay safe.

    Open points to check first: whether gVisor or Kata runs on the homelab nodes (a RuntimeClass), the start-up time of a sandbox against the 23 s to 15 min Jobs we see now, and how the worktree reaches the sandbox.

    Sources: https://github.com/kubernetes-sigs/agent-sandbox

  8. 11 remaining items

  9. dan-petty commented on Nov 12, 2026

    @dan-petty
    OwnerAuthor

    The command gate plan (tracker #5199) proposes an egress part for this item. The owner has not accepted it yet (open question 3 of #5199).

    Why: the runner Job can reach any public host on 443 (the public HTTPS rule of networkpolicy.yaml). The allowlisted uv run python <file> can send any data to any host, so neither the gate lists (#5201) nor Jev (#5206) limit the harm "sends data to a host". The cluster has no FQDN network policy (no CiliumNetworkPolicy or toFQDNs in k8s/).

    Proposed scope to add:

    • The public HTTPS of the runner goes through a forward proxy with an SNI host allowlist: github.com, api.github.com, codeload.github.com, objects.githubusercontent.com, raw.githubusercontent.com, pypi.org, files.pythonhosted.org, and the hosts of roadmap.command_gate.hosts.
    • The NetworkPolicy admits 443 only to that proxy.
    • Open tool: Envoy (Apache-2.0) with SNI-based routing, so no TLS interception.
    • When it ships, the facts of implement_shell (feat(roadmap): build the command gate facts from the manifests and a probe #5203) change from "public 443, any host" to the host list.

    What stays in the gate: #5201 blocks curl, wget and git to a host off the host list, but only as an accident filter. The egress limit of this item is the boundary.

    Acceptance to add: a Job test where curl https://example.org fails and uv sync --frozen passes.

    Risk: the change affects the network of every runner Job. A host that is missing from the list makes a Job fail until the list gets that host.

  10. devops-cli-service commented on Nov 13, 2026

    @devops-cli-service
    Contributor

    The proposal at 4ef7c6f needs splitting into 3 items. A person splits the item into the items below, or replies in a comment or edits the body to keep one item, and the next refine round looks at the item again.

    1. feat(roadmap): test sandboxd and add the shell command backend #3694: test sandboxd as the command server, and add the shell command backend.
    2. feat(roadmap): add the three-container runner Job, policy and log reads #3700: add the two-container runner Job, the user and volume layout, the file import, and the admission policy change. Blocked by feat(roadmap): test sandboxd and add the shell command backend #3694.
    3. feat(roadmap): run implement and fix-checks as prepare/agent/publish phases #3702: route the implement steps through the shell backend, and update the guarantee text. Blocked by feat(roadmap): add the three-container runner Job, policy and log reads #3700.
  11. dan-petty commented on Nov 13, 2026

    @dan-petty
    OwnerAuthor

    Owner decision of 2026-11-13: proceed with gVisor. This replaces the rejection of gVisor that this issue body records from 2026-11-05.

  12. devops-cli-service commented on Nov 13, 2026

    @devops-cli-service
    Contributor

    The proposal at b4a4ffb needs splitting into 3 items. A person splits the item into the items below, or replies in a comment or edits the body to keep one item, and the next refine round looks at the item again.

    1. feat(roadmap): test sandboxd and add the shell command backend #3694: test sandboxd as the command server, and add the shell command backend.
    2. feat(roadmap): add the three-container runner Job, policy and log reads #3700: add the two-container runner Job under the gVisor RuntimeClass, the user and volume layout, the file import, and the admission policy change. Blocked by feat(roadmap): test sandboxd and add the shell command backend #3694 and feat(k8s): measure runsc against runc for RuntimeClass gvisor #5434.
    3. feat(roadmap): run implement and fix-checks as prepare/agent/publish phases #3702: route the implement steps through the shell backend, and update the guarantee text. Blocked by feat(roadmap): add the three-container runner Job, policy and log reads #3700.
  13. added a commit that references this issue on Nov 16, 2026
  14. devops-cli-service commented on Nov 18, 2026

    @devops-cli-service
    Contributor

    The result in the alternatives block of the issue body changed. Before this check: partly, tool https://github.com/vstorm-co/pydantic-ai-backend. A person decides what the new result means for the item.

    Searches (6)

    Tools considered:

    Searches run:

    • pydantic-ai WorkspaceBackend sandboxed shell command execution backend, results: 5
    • sandboxd agent-sandbox command server REST API co-located container, results: 5
    • agent-sandbox.sigs.k8s.io docs sandbox runtime-agnostic, results: 5
    • kubernetes-sigs agent-sandbox sandboxd, results: 5
    • vstorm-co pydantic-ai-backend KubernetesWorkspace pods/exec, results: 5
    • github kubernetes-sigs agent-sandbox Sandbox CRD, results: 5

    Sources:

  15. dan-petty commented on Nov 20, 2026

    @dan-petty
    OwnerAuthor

    Owner decisions (2026-11-20, direct answers), after a design study with a critic (#6519, experiment 1 step 3):

    1. Sequential split replaces the design of 2026-11-05 (comments 6662676867 and 6667773105). One Job pod runs three containers one after the other: prepare (init container, App key) does the GitHub reads and the clone and records the base; agent (init container, model key only) runs stock Coder with its shell and writes a patch and a summary to a shared emptyDir; publish (app container, App key) starts only after the agent container exits, applies the patch as data to a fresh clone, writes its own commit, pushes and opens a draft PR. This is the pattern of GitHub Agentic Workflows safe outputs, Codex cloud and the Copilot cloud agent. feat(roadmap): test sandboxd and add the shell command backend #3694 (sandboxd command server) closes as not planned; feat(roadmap): run implement and fix-checks as prepare/agent/publish phases #3702 and feat(roadmap): add the three-container runner Job, policy and log reads #3700 get new scopes. The critic's blockers become acceptance criteria (no agent-written code in prepare, the Job log read per container, the base of a Staged item, per-container policy rules for init containers, where the PR body text is written, the symlink stop, the guards in prepare and publish).
    2. workflows: write is granted only when the merged plan of the item names a workflow file; prepare reads that from main, where the agent cannot change it.
    3. Model key: runner Jobs keep the current key for now.

    Cost estimate of the critic (not measured): about 2-3k changed lines, 2.5-4 days. The rewrite of this issue and of #3700/#3702 follows.

  16. dan-petty commented on Nov 20, 2026

    @dan-petty
    OwnerAuthor

    Owner answers (2026-11-20) to the key questions of this item:

    1. Where the implement Job ends: at "draft PR opened". The publish container opens the draft PR and the Job ends. The Service watch row marks the PR ready and starts fix-checks Jobs for failed checks. feat(roadmap): run implement and fix-checks as prepare/agent/publish phases #3702 deletes the WIP pushes and the in-Job CI watch, fix and ready loop, and the implement grade follows the forge outcome of the PR across the later fix-checks Jobs.
    2. One approval for PRs of the App: not now. The ruleset stays as it is.
    3. gVisor: stays a later whole-pod layer; step 3 does not wait for feat(k8s): measure runsc against runc for RuntimeClass gvisor #5434.
  17. dan-petty commented on Nov 25, 2026

    @dan-petty
    OwnerAuthor

    Verified complete on origin/main (62f17da50) and on the live devops namespace:

    1. Split issues merged and released.
      • #3702 closed (54de847da / PR #6670, 6e497c2b7 / PR #6709, shipped in v0.189.0+).
      • #3700 closed (97d6bc7ba / PR #6732, 84c0627e7 / PR #6695, shipped in v0.194.0).
      • Interim job git controls deleted in #6691 (8f363e6c1 / PR #6790).
    2. Owner key questions answered. All three questions have owner answers in the comment of 2026-11-20T18:39:46Z.
    3. Live three-phase proof in devops namespace (kubectl -n devops).
      • Implement Job devops-cli-implement-devops-cli-4704-7f165d (pod devops-cli-implement-devops-cli-4704-7f165d-s6p6w, succeeded: 1, PR #7007 merged):
        • prepare (init): 2026-11-24T17:30:32Z to 17:34:11Z, exit 0, holds DEVOPS_CLI_SERVICE_GITHUB_APP_PRIVATE_KEY only, mounts run, state, prepare-tmp, prepare-home, config.
        • agent (init): 2026-11-24T17:34:12Z to 18:20:23Z, exit 0, holds DEVOPS_CLI_AI_API_KEY only (no App key), mounts run, agent-tmp, agent-home, config (no state or prepare-home).
        • publish (main): 2026-11-24T18:20:23Z to 18:21:25Z, exit 0, started after agent terminated, holds DEVOPS_CLI_SERVICE_GITHUB_APP_PRIVATE_KEY only, mounts run and state readOnly: true.
      • Fix-checks Job devops-cli-fix-checks-devops-cli-4704-58184c1c44 (pod devops-cli-fix-checks-devops-cli-4704-58184c1c44-62tld, succeeded: 1, --pull 7007):
        • prepare (init): 2026-11-24T18:41:27Z to 18:42:23Z, exit 0, DEVOPS_CLI_SERVICE_GITHUB_APP_PRIVATE_KEY only.
        • agent (init): 2026-11-24T18:42:24Z to 18:59:24Z, exit 0, DEVOPS_CLI_AI_API_KEY only.
        • publish (main): 2026-11-24T18:59:25Z to 18:59:41Z, exit 0, started after agent terminated, DEVOPS_CLI_SERVICE_GITHUB_APP_PRIVATE_KEY only.

    Note: moving CronJob roadmap-stage to the three-container shape is tracked separately in #6814 (after #6705 and #6813).

  18. removed
    status/new
    on Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/highpriority/p2-mediumscope/roadmapsource/agenttype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions