Skip to content

feat(roadmap): the model container of a unit holds no credential #5506

Open

Description

@dan-petty

Problem or Motivation

ADR 0021 plans a split of each agent unit into a model container and a write container. The approved pipeline split design (tracker #5482) applies least privilege to the model container: it holds no credential, and a write container applies typed writes with caps. The split is the gate of the research units: no unit that reads web pages, other than stage, leaves mode plan before it. This item builds the pattern on one template. Each later unit item uses it.

Proposed Solution & Architectural Design

Target Subsystem

Roadmap jobs and Kubernetes manifests (k8s/devops/, src/devops_cli/roadmap/).

Acceptance Criteria

  • Test first: the template test fails on a template whose model container has a Secret reference. The test fails on the base.
  • A test: a typed write over its cap is refused and logged.
  • A test: the environment of the model container holds no App credential, no gateway credential and no webhook credential.
  • Live proof: after the merge, the release and O4, the alternatives unit runs as the App in mode plan on 3 live New items. A comment on this issue gives the result lines and the writes that the write container applied.

Existing Tool Considered

The gh-aw safe-outputs pattern (a pattern only: gh-aw runs on GitHub Actions, which the design rejects as the engine) and Argo multi-container templates cover the design. #3109 (closed) compared the write paths. Build: 300,000 to 500,000 agent tokens and 1 day.

Related

Tracker #5482, Phase 4. Depends on #4566, #4573, #3700, #3820 and #5498. #2695. It replaces #3109. Owner step O4 (#5014).

Source: #5482

Alternatives check of 2026-12-01: in-use.
The repository already uses this tool.
Tool: Kubernetes (https://github.com/kubernetes/kubernetes), Apache-2.0, last activity 2026-12-01, maintained.
Reason: Searches found Kubernetes, which the project already uses. It gives the two-container pod, the shared emptyDir and admission rules, but not the capped writer, the broker or the template test.

Covers:

  • Multi-container pod with one model container and one write container
  • Shared emptyDir volume mounted in both containers
  • Admission rules that refuse a Secret reference in a named container
  • Secret references scoped to the write container only

Lacks:

  • No typed write proposals with caps over a window
  • No loopback broker that adds the gateway key
  • No test that scans every roadmap unit template

Proposed design

Problem statement

The model container of a roadmap unit holds the GitHub App key and the model gateway key in its environment, so a prompt injection can read both. This change builds the two-container pattern on the alternatives unit template: the model container runs the agent and holds no App, gateway or webhook credential. The write container holds the App key, mints the scoped token of the job row and applies typed writes with caps. The k8s row of devops ci fails a pod spec whose model container references a Secret or holds a credential. The live proof is a gate after the merge, the release and owner step O4.

Acceptance criteria

Requirement: No Secret reference in a model container

The k8s row of devops ci SHALL fail when a pod spec under k8s/devops/ gives a container named model a Secret reference.

Scenario: A model container with a secretKeyRef

  • WHEN The k8s check reads a fixture pod spec whose model container has a secretKeyRef, and uv run pytest -q tests/gate/k8s_checks/test_unit_model_container.py runs.
  • THEN The check fails and names the container and the Secret key.

Requirement: No credential in the env of a model container

The k8s row of devops ci SHALL fail when the env of a container named model in a pod spec under k8s/devops/ holds the App key, the gateway key or the webhook secret.

Scenario: The App key as a plain env value

  • WHEN The k8s check reads a fixture pod spec whose model container sets DEVOPS_CLI_SERVICE_GITHUB_APP_PRIVATE_KEY in its env, and uv run pytest -q tests/gate/k8s_checks/test_unit_model_container.py runs.
  • THEN The check fails and names the variable.

Requirement: One write container for a model container

A pod spec under k8s/devops/ that names a container model MUST name exactly one container write.

Scenario: A model container with no write container

  • WHEN The k8s check reads a fixture pod spec that names a model container and no write container, and uv run pytest -q tests/gate/k8s_checks/test_unit_model_container.py runs.
  • THEN The check fails and names the pod spec.

Requirement: A shared proposals volume for the two containers

A pod spec under k8s/devops/ that names a model container and a write container MUST mount one emptyDir in both containers.

Scenario: A model container and a write container with no shared volume

  • WHEN The k8s check reads a fixture pod spec whose model container and write container mount no shared emptyDir, and uv run pytest -q tests/gate/k8s_checks/test_unit_model_container.py runs.
  • THEN The check fails and names the pod spec and the missing volume.

Requirement: Every pod spec passes the k8s row

Each pod spec under k8s/devops/ MUST pass the k8s row with no Secret reference and no credential in a container named model.

Scenario: The pod specs in the repository

  • WHEN uv run devops ci --check --only k8s runs over k8s/devops/.
  • THEN The row passes with 0 failed cases.

Requirement: A typed write over its cap is refused and logged

The write container SHALL refuse each typed write proposal that exceeds the cap of its kind and SHALL write one log line with the kind, the cap and the count.

Scenario: One comment more than the cap of comment

  • WHEN uv run pytest -q tests/roadmap/test_typed_writes.py runs the writer over a batch with one more comment proposal than the cap of comment.
  • THEN The writer applies the comments within the cap, applies none over it, and writes one log line with the kind, the cap and the count.

Requirement: A typed write within its cap is applied

The write container SHALL apply each typed write proposal that is within the cap of its kind with the scoped access token of the job row.

Scenario: One comment proposal in the shared emptyDir

  • WHEN uv run pytest -q tests/roadmap/test_typed_writes.py runs the writer over one comment proposal in the shared emptyDir.
  • THEN The writer applies the comment with the scoped token that the job row minted.

Requirement: The model container reaches the gateway through the broker

The model container SHALL send each model request to the loopback broker in the write container and MUST carry no gateway credential.

Scenario: A model request from the model container

  • WHEN uv run pytest -q tests/roadmap/test_model_container.py runs the model client with DEVOPS_CLI_BROKER_URL and DEVOPS_CLI_BROKER_TOKEN set and no gateway key.
  • THEN The request goes to 127.0.0.1 on the broker port with the broker token and carries no gateway key.

Requirement: Pending a person after the merge

After the merge, the release and owner step O4, the alternatives unit SHALL run as the App in mode plan on 3 live New items.

Scenario: The live proof of the alternatives unit

  • WHEN After the merge, the release and owner step O4, a person runs the alternatives unit as the App in mode plan on 3 live New items.
  • THEN The unit runs, and a comment on the issue gives the result lines and the writes that the write container applied.

Existing Tool Considered

Kubernetes (kubernetes/kubernetes, Apache-2.0, maintained) is the existing tool, with verdict in-use. The alternatives check in the issue body gives the reason and lists what Kubernetes covers and lacks. The repository already uses Kubernetes. This change uses the parts that the block lists as covers, and it builds the capped writer, the broker separation and the template check that the block lists as lacking. The issue body gives the written cost of that code: 300,000 to 500,000 agent tokens and 1 day to build. It gives no separate keep-and-fix figure.

Key questions

  • Which container holds the GitHub App credential?: The write container holds the App credential. It reads DEVOPS_CLI_SERVICE_GITHUB_APP_PRIVATE_KEY from Secret devops-cli in namespace devops with a key-level secretKeyRef. The model container references no Secret key and holds no App, gateway or webhook credential. (best practice) [sources: SECURITY.md, docs/adr/0021-the-roadmap-service-is-a-webhook-router-cluster-pods-run-the-roadmap-jobs-and-valkey-holds-their-shared-state.md, docs/adr/0004-ci-is-the-authoritative-gate.md]
    • Chosen: The write container holds the App credential. It keeps the key out of the container that runs the agent.
    • Rejected: The model container holds the App credential. A prompt injection reads the key.
    • Rejected: Both containers hold the App credential. It gives the model container the key that the split removes.
  • How does the model container reach the model gateway with no gateway credential?: The write container runs the loopback broker of feat(roadmap): a loopback gateway broker in the job process #3820 and holds the gateway key. It writes the broker address and a short-lived broker token to the shared emptyDir for the model client. The model container sends to 127.0.0.1 and holds no gateway key. (best practice) [sources: src/devops_cli/roadmap/implement/implement_shell.py, SECURITY.md, docs/adr/0021-the-roadmap-service-is-a-webhook-router-cluster-pods-run-the-roadmap-jobs-and-valkey-holds-their-shared-state.md]
    • Chosen: Loopback broker in the write container. The job shell already sets the broker URL and token, and the broker adds the AI key to each forwarded request.
    • Rejected: Gateway key in the model container. A prompt injection reads the key.
    • Rejected: Gateway key in a file on the shared emptyDir. Both containers read the file, so the model container still holds the credential.
  • Where does the model container write its typed write proposals?: The model container writes one proposal file for each typed write to a dedicated emptyDir that both containers mount. The write container reads the proposal and applies the write. The home emptyDir holds the checkout and is not the proposal path. (best practice) [sources: k8s/devops/cronjob-runner.yaml, docs/adr/0021-the-roadmap-service-is-a-webhook-router-cluster-pods-run-the-roadmap-jobs-and-valkey-holds-their-shared-state.md]
    • Chosen: A dedicated shared emptyDir for the proposals. The volume ends with the pod, and the home emptyDir holds the checkout that the model container must not write.
    • Rejected: The home emptyDir of the pod. The home volume holds the checkout, so a proposal path could reach it.
    • Rejected: A local port on the write container. It adds a listener and a port that the pod must guard.
  • How does the write container cap a typed write?: The writer keeps one cap for each kind in one table over a time window. It follows the refine comment cap: CONST_ROADMAP_REFINE_MAX_COMMENTS_PER_ITEM is 2 comments on one item in CONST_ROADMAP_REFINE_COMMENT_CAP_WINDOW_HOURS, which is 24. The writer counts the proposals of each kind, applies the ones within the cap, refuses the rest and writes one log line with the kind, the cap and the count. (best practice) [sources: src/devops_cli/config/constants.py:3696, src/devops_cli/config/constants.py:3697, tests/roadmap/refine/test_roadmap_refine_comment_cap.py]
    • Chosen: One cap for each kind in one table, over a window. It follows the project comment cap at src/devops_cli/config/constants.py:3696 and src/devops_cli/config/constants.py:3697.
    • Rejected: One cap for the batch. One large kind uses the whole budget and the other kinds get none.
    • Rejected: No cap. A loop in the model writes with no limit.
  • Does the template check require every roadmap unit template to name a model container?: No. The check refuses a Secret reference and a credential in a container named model, and it requires exactly one write container when a model container exists. The stage and runner templates hold the Secret keys of their job today, and this issue does not change them. A rule that required the pattern on every template would fail on the base. (best practice) [sources: k8s/devops/cronjob-stage.yaml, k8s/devops/cronjob-runner.yaml, docs/adr/0021-the-roadmap-service-is-a-webhook-router-cluster-pods-run-the-roadmap-jobs-and-valkey-holds-their-shared-state.md]
    • Chosen: Scope the check to a container named model. The stage and runner templates keep their Secret keys, so a rule for every template fails on the base for work this issue does not do.
    • Rejected: Require every roadmap unit template to have a model container. It fails on the base for the stage and runner templates, which this issue does not change.
    • Rejected: Exempt a list of templates. The list rots and a new unit escapes it.
  • Is the loopback broker of feat(roadmap): a loopback gateway broker in the job process #3820 already built?: The job shell already sets DEVOPS_CLI_BROKER_URL and DEVOPS_CLI_BROKER_TOKEN for a step. This item uses that broker interface and adds no broker work, so feat(roadmap): a loopback gateway broker in the job process #3820 is no dependency. [sources: src/devops_cli/roadmap/implement/implement_shell.py, tests/roadmap/implement/test_roadmap_implement_job.py]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#4566, #4573, #3700, #5498

Activity

  1. added
    source/agent
    on Nov 13, 2026
  2. added
    type/feature
    scope/roadmap
    status/new
    value/high
    effort/medium
    on Nov 13, 2026
  3. dan-petty commented on Nov 13, 2026

    @dan-petty
    OwnerAuthor
  4. added
    priority/p2-medium
    on Nov 13, 2026
  5. devops-cli-service commented on Nov 18, 2026

    @devops-cli-service
    Contributor

    Owner question: Do you do owner step O4 and split the devops-cli Secret? (a person decides)

    Options

    1. Decide the question: The job refines the item with your answer.
    2. Leave it to the job: The job records the best-practice answer and goes on.

    Recommendation: Decide the question: only a person can answer it.

    Evidence

  6. devops-cli-service commented on Nov 20, 2026

    @devops-cli-service
    Contributor

    The result in the alternatives block of the issue body changed. Before this check: no check. A person decides what the new result means for the item.

    Searches (9)

    Tools considered:

    Searches run:

    • open source safe-outputs pattern AI agent write actions with caps separate container, results: 5
    • Kubernetes two-container pod separate agent container from credential holder sidecar, results: 5
    • gh-aw safe outputs agentic workflow write actions limits, results: 5
    • kubernetes/kubernetes repository github, results: 5
    • agent outbox typed write proposals rate cap apply writes tool, results: 5
    • "safe outputs" GitHub Agentic Workflows, results: 5
    • Kyverno policy deny Secret reference in container environment, results: 5
    • site:kubernetes.io emptyDir volume pod containers, results: 5
    • Kubernetes emptyDir documentation volumes, results: 5

    Sources:

  7. devops-cli-service commented on Nov 21, 2026

    @devops-cli-service
    Contributor

    Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies in the section Proposed design of the body.

  8. dan-petty commented on Nov 21, 2026

    @dan-petty
    OwnerAuthor

    Answer to the owner question "Do you do owner step O4 and split the devops-cli Secret?": yes, as I decided on 2026-11-12 in #5014. O4 is a Phase 4 owner step.

    #5014, #3105, #6519 and #6521 are no dependencies of this item.

  9. devops-cli-service commented on Nov 21, 2026

    @devops-cli-service
    Contributor

    Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies in the section Proposed design of the body.

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/mediumpriority/p2-mediumscope/roadmapsource/agentstatus/newtype/featurevalue/high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions