Skip to content

feat(roadmap): add the stage Job template and one-item entry point - #5545

Merged
dan-petty merged 9 commits into
mainfrom
feat/5483-stage-job-template-entry
Nov 13, 2026
Merged

dan-petty merged 9 commits into
mainfrom
feat/5483-stage-job-template-entry

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

Part 1 of #4559, to merge before part 2: a stage Job plans one item in a pod of its own, so a rollout of the Service does not stop the plan. The Service rows do not change yet.

  • CronJob roadmap-stage, a suspended template: the Service image, 2 Secret keys, 250m/1Gi to 1/2Gi, deadline 10800 s, a new pod only after exit 75 or a disruption.
  • Admission policy: a stage branch that pins the args, the env names, the token repository and the deadline, and a delete policy for stage Jobs only. Role and SearXNG rows.
  • devops roadmap stage --job-item <n>: one model call slot, a GitHub request budget of its own, a time budget inside the Job deadline, exit 0/1/75/143 and a check-in at the end. It refuses an App token for more than its repository.
  • devops k8s run-job --template stage --repo <r> --item <n>.

Overlap: #4558, #5411, #5440.

Closes #5483
Change: openspec/changes/archive/2026-11-13-5483-stage-job-template-entry/

The stage job runs in the pod of the roadmap Service, and a rollout of the Service stops a running
stage round. This change adds the CronJob template roadmap-stage, the admission, Role and network
rows of a stage Job, and the entry point devops roadmap stage --job-item, with no change to the
rows of the Service (part 1 of #4559).
…limits

The deploy-stack manifest list applies cronjob-stage.yaml, the SearXNG pin tests name the pod of a
stage Job, and the limit table classes the new stage Job limits.
The setting roadmap.stage.github_requests_per_hour (#5483) adds the variable
DEVOPS_CLI_ROADMAP_STAGE_GITHUB_REQUESTS_PER_HOUR, whose name holds GITHUB. The
list of the GitHub variables in the config command test did not hold it.
… repository

A stage Job that holds the private key of the App now refuses to run,
before a clone or a model call, unless service.github_app.token_repository
is the repository of --repo, as the implement runner does (#2667). A
person who runs the command with their own token runs it locally.
…p its MCP token

The admission policy now holds a stage Job of the Service to the args
roadmap stage --repo <owner/name> --job-item <n> --confirm, to the plain
env names of the template and of stage_job_env, to a token repository
equal to --repo, and to the deadline of 10800 s. The pod gets 120 s to
check in after a SIGTERM. The MCP token leaves the pod: roadmap.stage.mcp
is off, and the server accepts one token for every role. The spend panel
names the end user roadmap-stage.
@dan-petty dan-petty added type/feature Type feature: a new function scope/roadmap The roadmap jobs: intake, refine, stage, implement and the Service that runs them labels Nov 13, 2026
@dan-petty

Copy link
Copy Markdown
Owner Author

Local results at head ce1373d33 (rebased on origin/main d44b9fa4e).

Tests first:

  • Base replay of the first build: the new and changed tests on the merge base gave 12 failed tests and 2 test modules that could not import (32 new tests). All 92 tests that existed before passed.
  • Review fixes: the 4 new tests of the token scope (test_roadmap_stage_job_entry.py) and 14 new gate cases (job_admission_policy.py, stage_job.py) failed before the fix and pass now.

Checks:

  • uv run devops ci --check --only lint,format,docs,openspec,constructs,test-tree,startup-imports,swallowed-failures,domain,test-settings,k8s: all pass.
  • uv run mypy on the changed src files: no issues.
  • uv run pytest tests/roadmap/stage tests/k8s tests/commands/k8s tests/commands/test_config_cmd.py tests/invariants tests/security tests/grafana tests/config: 6974 passed, 1 skipped.
  • kubectl kustomize k8s/overlays/homelab/devops diff against main: new CronJob roadmap-stage, new policy and binding roadmap-service-job-deletes, new NetworkPolicy searxng-stage-clients, and changes to roadmap-service-jobs, the Role, searxng-clients and searxng-perimeter.
  • kubectl apply --dry-run=server of the policy, the CronJob, the Role and the 2 SearXNG files (first build): the API server v1.37.2+k3s1 accepted all of them.

Review fixes in this PR: the Job refuses an App token for more than its repository; the policy pins the args, the plain env names, the token repository (= --repo) and the deadline 10800 of a stage Job; the MCP token left the pod (roadmap.stage.mcp is off live); terminationGracePeriodSeconds: 120; the spend panel names roadmap-stage.

Live proof after the release (the in-pod stage row still runs until #4559):

  1. After Argo CD syncs: kubectl get validatingadmissionpolicy roadmap-service-jobs roadmap-service-job-deletes -o jsonpath='{..typeChecking}' shows no warning.
  2. Pick a Ready item that the in-pod row cannot take during the test: start just after a stage round, or set roadmap.stage.interval_minutes high in the ConfigMap for the test.
  3. uv run devops k8s run-job --template stage --repo dan-petty/devops-cli --item <n> -- roadmap stage --repo dan-petty/devops-cli --job-item <n> --confirm
  4. While the Job runs: kubectl -n devops rollout restart deploy/roadmap-service. The Job pod keeps running.
  5. The Job ends with exit 0 and the draft plan PR of item <n> opens. The command prints the GitHub requests of the pod.
  6. State sum(increase(devops_cli_github_requests_total{job="roadmap-stage"}[3h])) on feat(roadmap): run each stage item in its own Job #4559, against the 3,357 requests a day of the stage row.

@dan-petty

Copy link
Copy Markdown
Owner Author

Check results

Head commit: ce1373d337b56d93be4bb257b63c5de3c2a0c030

Check Conclusion Link
Tests & Coverage success run
devops-cli success run
zizmor success run
trivy-config success run
CodeQL success run
Plan Check skipped run
Tests on Main skipped run
Fail-to-Pass Check skipped run
Dependency Freshness skipped run
Test Job Duration skipped run
Runner Image success run
MCP Server Image success run
Tests & Coverage (shard 4 of 4) success run
Changed-Test Independence success run
Design Tokens success run
Tests & Coverage (shard 1 of 4) success run
Tests & Coverage (shard 2 of 4) success run
Tests & Coverage (shard 3 of 4) success run
Static Analysis success run
Service Image success run
Analyze (actions) success run
Image Pins success run
Analyze (python) success run
Semantic PR title success run
Docs Site Build success run

Skipped check: Plan Check
Skipped check: Tests on Main
Skipped check: Fail-to-Pass Check
Skipped check: Dependency Freshness
Skipped check: Test Job Duration

@dan-petty
dan-petty marked this pull request as ready for review November 13, 2026 20:25
@dan-petty
dan-petty merged commit 28db551 into main Nov 13, 2026
25 checks passed
@dan-petty
dan-petty deleted the feat/5483-stage-job-template-entry branch November 13, 2026 20:30
dan-petty added a commit that referenced this pull request Nov 13, 2026
The stage row of the Service submits one stage Job for each Ready item
(part 2 of #4559, after #5545), so a rollout of the Service no longer
stops a plan.

- The row moves to the status lane and plans nothing. It recovers each
check-out whose Job ended with no check-in, then creates Jobs up to
`roadmap.stage.jobs` (default 1, for the whole cluster).
- It acts on a Job only when the item label of the Job names the item,
and frees only what `check_in` wrote.
- Only `timeout` and `plan_defect` ends count toward the split. An
orphan removal keeps the failure ledger.
- The in-pod stage path and the stage use of the model clone go.
- New alert `RoadmapStageGitHubRequestsHigh`; the throttle alert reads
both jobs.
- The kept plan file stays until #5499.

Overlap: #5026, #5440, #4558, #5411, #4555, #5524.

Closes #4559
Change:
`openspec/changes/archive/2026-11-13-4559-run-each-stage-item-in-its-own-job/`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/roadmap The roadmap jobs: intake, refine, stage, implement and the Service that runs them type/feature Type feature: a new function

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(roadmap): add the stage Job template and one-item entry point

1 participant