Repository navigation
Description
Problem
CronJob roadmap-stage runs stage in one container that holds the App key and the model key. #6705 gives the stage agent a real shell, so the agent must run in a container with no App key, as the runner Job does since #3700.
Change
- CronJob
roadmap-stagegets the init containersprepareandagentand the containerpublish, with the volumes and keys of the runner template: onlyprepareandpublishread the App key, and onlyagentreads the model key. - The admission policy
roadmap-service-jobsadmits a stage Job with the three containers and pins the same rules for it as for the runner Job. The one-container stage shape stays allowed only on UPDATE. - Merge only after a release holds refactor(roadmap): stage runs its three phases on one run folder #6813, and the stage CronJob runs that release's image.
Acceptance criteria
- The k8s gate checks admit the three-container stage Job and refuse a stage Job with the App key on
agent. - One live stage Job passes on the three containers.
Dependencies
Source
Source: #6705
Alternatives check of 2026-11-23: not-applicable.
Class: refactor, no search.
Tool: none found.
Proposed design
Problem statement
CronJob roadmap-stage runs the stage job in one container that holds the App key and the model key. #6705 gives the stage agent a real shell, so the agent must run with no App key, as the runner Job does since #3700. The change runs stage as the init containers prepare and agent and the container publish, with the volumes and key split of the runner template, and pins the same rules in the admission policy roadmap-service-jobs.
Acceptance criteria
Requirement: stage-cronjob-three-containers
CronJob roadmap-stage SHALL run the init containers prepare and agent and the container publish.
Scenario: three containers rendered
- WHEN
uv run devops ci --check --only k8sruns the k8s gate on the rendered manifests - THEN the gate shows CronJob
roadmap-stagewith the init containersprepareandagentand the containerpublish, and reports no violation
Requirement: stage-state-volume-off-agent
The stage Job SHALL mount the state volume in prepare and publish only, as the runner template does.
Scenario: state volume and the agent container
- WHEN
uv run devops ci --check --only k8sruns the k8s gate on the rendered manifests - THEN the gate shows the state volume in
prepareandpublish, and no state volume inagent
Requirement: stage-keys-split
The stage Job SHALL mount the App key in prepare and publish only and the model key in agent only.
Scenario: keys on the three containers
- WHEN
uv run devops ci --check --only k8sruns the k8s gate on the rendered manifests - THEN the gate shows the App key in
prepareandpublish, the model key inagent, no App key inagent, and no model key inprepareorpublish
Requirement: stage-app-key-not-on-agent
The admission policy roadmap-service-jobs MUST refuse a stage Job that mounts the App key in the agent container.
Scenario: App key on the agent container
- WHEN
uv run devops ci --check --only k8sruns the admission policy check on a stage Job whoseagentcontainer mounts the App key - THEN the check shows the Job refused, and the violation names the
agentcontainer
Requirement: stage-model-key-not-on-prepare-or-publish
The admission policy roadmap-service-jobs MUST refuse a stage Job that mounts the model key in the prepare or the publish container.
Scenario: model key on the publish container
- WHEN
uv run devops ci --check --only k8sruns the admission policy check on a stage Job whosepublishcontainer mounts the model key - THEN the check shows the Job refused, and the violation names the
publishcontainer
Requirement: stage-one-container-on-update-only
The admission policy roadmap-service-jobs SHALL admit a one-container stage Job on UPDATE only.
Scenario: one-container stage Job on CREATE and on UPDATE
- WHEN
uv run devops ci --check --only k8sruns the admission policy check on a one-container stage Job as CREATE and as UPDATE - THEN the check shows the CREATE refused and the UPDATE admitted
Requirement: stage-submit-reads-the-container-that-ended
The stage submit step MUST read the log of the stage container that ended.
Scenario: agent ends at the deadline
- WHEN a unit test runs the stage submit step on a Job whose
agentcontainer ended at the deadline and whosepublishcontainer never started - THEN the step classes the result
timeoutand reads the log ofagent
Requirement: stage-pod-failure-policy-matches-each-container
The pod failure policy of CronJob roadmap-stage MUST fail the Job on an exit code other than 75 of prepare, agent or publish, and MUST run the pod again on exit 75.
Scenario: pod failure rules for the three containers
- WHEN
uv run devops ci --check --only k8sruns the k8s gate on the rendered manifests - THEN the gate shows a FailJob rule with operator
NotInand value 75 for each ofprepare,agentandpublish, and a rule with operatorInand value 75 for each that does not fail the Job
Requirement: stage-one-request-budget
The stage prepare and publish phases MUST keep their GitHub requests in one budget record on the state volume.
Scenario: prepare spends the budget
- WHEN a unit test runs
prepareuntil the budget is spent, then runspublishon the same run folder - THEN
publishwaits for the window thatpreparewrote, and the two phases send no more thanroadmap.stage.github_requests_per_hourin the hour
Requirement: stage-live-job-passes
One live stage Job MUST pass on the three containers.
Scenario: live stage Job
- WHEN the live check runs
uv run devops k8s run-job --template stage --repo <owner/name> --item <n> -- roadmap stage --repo <owner/name> --job-item <n> --confirm - THEN the Job ends
Completeand the containersprepare,agentandpublisheach exit with code 0
Existing Tool Considered
The alternatives check of 2026-11-23 in the issue body records not-applicable and names no tool. The open, maintained tools that cover the need are the Kubernetes batch/v1 CronJob and Job with init containers and the admissionregistration.k8s.io/v1 ValidatingAdmissionPolicy, which the runner Job already uses (k8s/devops/cronjob-runner.yaml, k8s/devops/roadmap-service/admissionpolicy.yaml). They lack a GitHub request budget that two containers of one pod share; the project's RequestBudget covers that with a record on the state volume (src/devops_cli/server/service.py:219). The change adds no new component beyond that record and the stage phases, so its cost is the edit of the CronJob, the policy and the stage code.
Key questions
- Which container holds the App key, and which holds the model key, in the stage pod?:
prepareandpublishhold the App key. Onlyagentholds the model key. The stage pod copies the key split of the runner template. (best practice) [sources: k8s/devops/cronjob-runner.yaml, docs/adr/0030-roadmap-steps-run-their-agent-apart-from-the-app-key.md, k8s/devops/roadmap-service/admissionpolicy.yaml]- Chosen: Copy the key split of the runner template. The runner Job runs this split since feat(roadmap): add the three-container runner Job, policy and log reads #3700, and one template keeps the rules equal.
- Rejected: Keep one container with both keys. refactor(roadmap): the stage agent is stock Coder #6705 gives the stage agent a real shell, so that shell would reach the App key.
- Does the one-container stage shape stay allowed?: Yes, on UPDATE only. The policy admits the one-container stage shape on UPDATE and refuses it on CREATE. (best practice) [sources: k8s/devops/roadmap-service/admissionpolicy.yaml, tests/gate/k8s_checks/job_admission_policy.py, src/devops_cli/k8s/cluster_job.py:74]
- Chosen: Admit the one-container shape on UPDATE only. A one-container Job that runs during the rollout keeps its deadline patch, and a new Job must use the three containers.
- Rejected: Refuse the one-container shape on CREATE and on UPDATE. It refuses the deadline patch of a stage Job that is already running.
- Rejected: Admit the one-container shape on CREATE and on UPDATE. It keeps the App key beside the agent for new Jobs.
- Which container log does the stage submit step read, and how does the pod failure policy match the three containers?: The stage submit step reads the log of the container that ended:
publishwhen it ran, elseagent, elseprepare. The pod failure policy namesprepare,agentandpublish. (best practice) [sources: src/devops_cli/roadmap/stage/stage_submit.py, src/devops_cli/k8s/cluster_job.py:74, k8s/devops/cronjob-stage.yaml]- Chosen: Read the log of the container that ran, and match each container in the policy. A deadline during
agentleavespublishunstarted, and an exit 1 ofpreparemust fail the Job. - Rejected: Read only the log of
publish, and name onlypublishin the policy. A deadline duringagentleaves nopublishlog, and an exit 1 ofpreparewould not fail the Job. - Rejected: Keep the container name
stage. No container is namedstageafter the change, so the log is empty and the policy matches no container.
- Chosen: Read the log of the container that ran, and match each container in the policy. A deadline during
- How do the stage
prepareandpublishphases keep one GitHub request budget?:prepareandpublishpass one record file on the state volume toRequestBudget, so the pod spendsroadmap.stage.github_requests_per_houronce an hour.agentmounts no state volume. (best practice) [sources: src/devops_cli/server/service.py:219, src/devops_cli/roadmap/stage/stage_job.py, src/devops_cli/roadmap/stage/stage_job_phases.py]- Chosen: One budget record on the state volume.
RequestBudgetkeeps a record across processes, and onlyprepareandpublishmount the state volume. - Rejected: A full budget in each of
prepareandpublish. The pod would spend twiceroadmap.stage.github_requests_per_hour. - Rejected: A separate budget volume. It adds a volume that the runner template does not have.
- Chosen: One budget record on the state volume.
- When can this change merge, and when does the live stage Job run?: The change merges after a devops-cli release holds refactor(roadmap): stage runs its three phases on one run folder #6813. The stage CronJob runs that release's runner image, and the live check runs on that release. (best practice) [sources: k8s/devops/cronjob-stage.yaml, k8s/devops/cronjob-runner.yaml, docs/CLUSTER.md]
- Chosen: Merge after a release holds refactor(roadmap): stage runs its three phases on one run folder #6813. The stage CronJob runs the released runner image, so the live check needs that release.
- Rejected: Merge now and run the live check later. The live stage Job would run containers that the released image does not have.
Fit
Fits in one pull request.
Suspected block
A devops-cli release that holds #6813.
Activity
dan-petty commentedon Nov 23, 2026
Both split stage into prepare, agent and publish, but #6704 delivers the code running on those phases while the candidate delivers the k8s container split with per-container secret isolation.dan-petty commentedon Nov 23, 2026
This item also depends on #6831. With no credential in the agent container, the planner loses its GitHub reads, and #6831 has prepare hand it that data. Merge this item only after a release holds #6813 and #6831.
The review of #6822 (2026-11-23) ran the three phases as separate processes. It found these points that this item must handle:
stage_submit.py(about line 212) reads the log of containerstage, and thepodFailurePolicynames containerstage. Without a change, a deadline end is classedci_infraand nottimeout, and a failed end is classed with no log.state/must be a volume thatagentcannot reach, as in the runner Job.state.target.replace_pullselects the pull request that publish updates, andtype_andslugselect the branch.--source <work clone>. The agent can write the git config and hooks of that clone.github_requests_per_hour, so one pod can spend twice the budget.git_showof history. devops-cli is public.dan-petty commentedon Nov 23, 2026
The dependency changes: #6813 is closed as not planned, and #6705 now builds the phases of stage together with the
Coderagent. Merge this item only after a release holds #6705 and #6831.dan-petty commentedon Nov 23, 2026
The stage agent of #6705 runs
devops openspec checkas one of its three checks (plan pull request #6841), andpublishruns it again. That check regenerates the OpenSpec skills in a scratch copy withopenspec update --force(src/devops_cli/openspec/skills.py:22), andCONTRIBUTING.md:60says that the regeneration needs access to github.com. So theagentcontainer and thepublishcontainer of this item need egress to github.com. Theagentcontainer must reach it with no credential.docs(openspec): plan #6705 Run the stage agent on stock Coder in a ph…
dan-petty commentedon Nov 23, 2026
A correction of my comment above.
devops openspec checkneeds github.com only when the committed skills differ from a regeneration. On 2026-11-23 it passed in 57 s on main with the proxies at a closed port andGIT_ALLOW_PROTOCOL=file. So theagentandpublishcontainers need no egress to github.com for that check.devops-cli-service commentedon Nov 23, 2026
Owner question: See the first point of Open questions and Watched files in the section Proposed design of the body.
Options
Recommendation: Decide the question: only a person can answer it.
Evidence
devops-cli-service commentedon Nov 23, 2026
Owner question: See Suspected block and Watched files in the section Proposed design of the body.
Options
Recommendation: Decide the question: only a person can answer it.
Evidence
refactor(roadmap): the stage agent is stock Coder (#6883)
devops-cli-service commentedon Nov 24, 2026
Owner question: See Suspected block in the section Proposed design of the body.
Options
Recommendation: Decide the question: only a person can answer it.
Evidence