Skip to content

feat(roadmap): test sandboxd and add the shell command backend #3694

Closed as not planned

Description

@dan-petty

Problem

The implement job runs the agent shell in the same pod and as the same user as the job that holds the GitHub session token (#2695). The owner chose two containers in one Job pod, so that the shell has no token. The job must then send each command of the agent to the shell container. This path does not exist.

The job cannot use the Kubernetes API for this path. The runner pod sets automountServiceAccountToken: false and its egress does not include the API server. A Kubernetes credential in the job adds a new credential to the zone that holds the token.

The owner accepted this order on 2026-11-05 (comment 6662676867 and the newest comment of #2695): test the sandboxd daemon of kubernetes-sigs/agent-sandbox as the command server before you write a server. If the test fails, build the small server and record the cost. Do not adopt the controller and the CRDs of that project.

Expected

A pydantic-ai WorkspaceBackend sends commands and file operations to a command server on localhost, with no Kubernetes credential. The server is sandboxd if the test passes, and a small server of this project if it fails. The change records the result of the test.

This item does not change the Job template (the next item in the split) or the implement job (the item after that).

Open points of sandboxd, not tested

Comment 6662676867 lists these points. The guide says that a co-located container "is useful only as a client of the sandboxd API (reaching it over pod-local networking)", and this is the chosen layout. Commands run in the container that hosts it, so they get the user and the image of the shell container. It has --listen-host=127.0.0.1 and --auth-token-file. It resolves each path with symlink evaluation and refuses a path outside --root-dir. Nobody ran it. Test these points:

  1. It may not run outside a Sandbox resource.
  2. The sandboxd modes of the Python client k8s-agent-sandbox need a Sandbox, and the client needs get on Sandboxes. So the backend must call the REST API and the gRPC ProcessService directly.
  3. The guide names no command allowlist. The allowlist stays on the job side.
  4. The time and output limits are not checked.
  5. The upstream example uses a staging image with the tag latest-main, and the v1.0.9 release assets are 3 manifests. No pinned image was found, so check the source of the binary first.

Adopt sandboxd only if it runs outside a Sandbox resource, confines each path to the worktree root, and has a pinned source.

Acceptance criteria

  • The ## Feasibility section of the proposal gives the result of each of the 5 open points, and how each was measured.
  • The change states one result: sandboxd is adopted, or it is refused with the point that failed. If it is refused, the pull request states the cost of the small server (AGENTS.md rule 3).
  • If sandboxd is adopted, the runner image holds it at a pinned version: a row in RUNNER_TOOLS of src/devops_cli/roadmap/runner_tools.py. The admission policy admits only the runner image, so a second image is not an option for this item.
  • The backend implements WorkspaceBackend, SupportsCommands and SupportsFilesystem of pydantic_ai.workspaces at the version that pyproject.toml pins.
  • The job side refuses a command whose first word is not in the allowlist. A test shows that the job returns an error and that no request gets to the server.
  • The job stops a command that passes its time limit or its output limit, and it reports the limit that stopped it. A test covers each limit. When a command writes more output than the limit, the job masks the excess output.
  • The server listens on 127.0.0.1 only. A test shows that it refuses a request with no auth token, or the proposal gives the reason that no token is necessary.
  • A test shows that a path outside the worktree root is refused, also through a symbolic link.
  • The tests run at the process edge: a real server process, a real socket and real commands.
  • The backend holds no Kubernetes client and reads no Kubernetes credential.

Existing tool considered

  • sandboxd of kubernetes-sigs/agent-sandbox (https://github.com/kubernetes-sigs/agent-sandbox): SIG Apps, Apache-2.0, v1.0.9 of 2026-10-29, API v1beta1, active. This item tests it first. The project is runtime-agnostic.
  • The controller and CRDs of agent-sandbox: refused by the owner for this item. Its threat model says: "Agent Sandbox itself does not implement isolation but supports configuring these runtimes." It needs a Kubernetes credential to read the Sandbox status, and the worktree must cross pods.
  • vstorm-co/pydantic-ai-backend (https://github.com/vstorm-co/pydantic-ai-backend): MIT, v0.2.39 of 2026-10-30. Its KubernetesWorkspace works through pods/exec and "the caller needs pods/exec RBAC on the namespace". Its mode="http" path is gone, so a job with no credential cannot use it. Its sandboxd is a different program, which holds a Docker socket.

Cost to build (AGENTS.md rule 3). These numbers are estimates for all 3 items of the split, from comment 6662676867. The base is the one eval run in k8s/README.md.

Option Build Elapsed Keep and fix
Two containers, own server 20 to 30 M input tokens, 100 to 200 k output tokens About 1 day Our server code, and its bugs are ours
Two containers, sandboxd About one third less About 1 day A small adapter, and a pin to update

Related

Source: #2695

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-18, maintained.
Reason: Searches found no pydantic-ai Workspaces backend that reaches a localhost command server with no Kubernetes credential; sandboxd supplies only the server side, and its run outside a Sandbox resource is untested.

Covers:

  • Serves commands and file operations over pod-local localhost networking
  • Binds on 127.0.0.1 and checks an auth token file
  • Refuses paths outside the root directory, also through symbolic links

Lacks:

  • No pydantic-ai Workspaces backend on the job side
  • No command allowlist, and no time or output limits
  • Unproven outside a Sandbox resource, and no pinned image

Activity

  1. added
    source/agent
    on Nov 5, 2026
  2. added
    type/feature
    scope/roadmap
    on Nov 5, 2026
  3. added
    status/new
    value/high
    effort/high
    on Nov 5, 2026
  4. devops-cli-service commented on Nov 5, 2026

    @devops-cli-service
    Contributor

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

    • Priority: P2-Medium. It is a prerequisite for the two-container design but is not a security fix or a blocking defect.
    • Value: High. Without this backend the implement job cannot send commands to the shell container at all.
    • Effort: High. It requires testing sandboxd, possibly building a server, implementing three interfaces, and writing tests for limits, auth, and path confinement.
    • Related: feat(roadmap): allow scoped review and RAG calls from the implement shell #3563, which asks for a different change. Both extend the implement shell, but the candidate builds the command transport while #3563 adds scoped review and RAG access through it.
  5. devops-cli-service commented on Nov 8, 2026

    @devops-cli-service
    Contributor

    Alternatives check: partly

    Reason: The searches and the repository facts found kubernetes-sigs/agent-sandbox, whose sandboxd is the co-located command/file server this item wants to test, and vstorm-co/pydantic-ai-backend, whose Kubernetes path needs pods/exec RBAC and whose mode="http" path is gone, so a tokenless job cannot use it. sandboxd covers only the server half of the need: it gives pod-local REST and gRPC ProcessService access, --root-dir path confinement and an auth token, but it is not a pydantic-ai WorkspaceBackend, it is unverified outside a Sandbox resource, and it has no allowlist, limits or pinned image, so the backend and its controls must still be written.

    Tool: kubernetes-sigs/agent-sandbox (https://github.com/kubernetes-sigs/agent-sandbox)

    • License: Apache-2.0
    • Last activity: 2026-11-07
    • Maintained: yes

    Covers:

    • Runs a command and file server (sandboxd) in the shell container, reachable over pod-local networking through a REST API and a gRPC ProcessService.
    • Resolves each path with symlink evaluation and refuses paths outside --root-dir, and offers --listen-host=127.0.0.1 plus --auth-token-file.
    • Is an open, actively maintained project (Apache-2.0, SIG Apps), so it is a credible base for the test that the owner ordered.

    Lacks:

    • No pydantic-ai WorkspaceBackend, SupportsCommands or SupportsFilesystem adapter; the item still writes that backend against the REST and gRPC APIs.
    • Not shown to run outside a Sandbox resource, and the k8s-agent-sandbox client needs get on Sandboxes, so the backend must bypass the client.
    • No command allowlist and no time or output limits; both stay on the job side.
    • No pinned binary or image: the example uses a latest-main staging tag and the v1.0.9 release assets are manifests, so a pinned source is unconfirmed.

    Tools considered:

    Searches run:

    • pydantic-ai workspaces WorkspaceBackend SupportsCommands local backend server, results: 5
    • pydantic_ai.workspaces WorkspaceBackend SupportsCommands SupportsFilesystem, results: 5
    • kubernetes-sigs agent-sandbox sandboxd daemon API, results: 5
    • github kubernetes-sigs agent-sandbox, results: 5
    • pydantic-ai backend sandbox shell commands library github, results: 5
    • agent-sandbox, results: 5
    • pydantic-ai-backend vstorm, results: 5
    • "agent-sandbox" kubernetes sigs repository, results: 5
    • sandboxd, results: 5

    Sources:

    Checked on 2026-11-08. A person decides what this means for the item. The check changes no label and closes no issue.

  6. dan-petty commented on Nov 20, 2026

    @dan-petty
    OwnerAuthor

    Closed as not planned. The owner chose a sequential split for #2695 on 2026-11-20 (comment 7045868447 on #2695). That design has no command server and no WorkspaceBackend of this project. The agent runs stock Coder on LocalWorkspace in its own container. #6527 deletes the job-side allowlist that this item would carry.

    The design study found these facts about sandboxd. They stay here for a later concurrent split:

    • A pinned image exists: registry.k8s.io/agent-sandbox/sandboxd:v1.0.11.
    • The default --listen-host is 0.0.0.0. There is no auth unless --auth-token-file or --auth-token-sha256 is set.
    • ExecuteWithLimits, with the flags --execute-{default,max}-time-limit and the stdout and stderr byte limits, gives time and output limits.
    • --root-dir confines the paths. There is no user switch.
    • It runs as a plain binary, outside a Sandbox resource (https://agent-sandbox.sigs.k8s.io/docs/api/runtime/).
    • The harness SSHWorkspace, in the pinned pydantic-ai-harness 0.59.0, is the stock fallback if a concurrent split is necessary later.
  7. removed
    status/new
    on Nov 20, 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/high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions