Repository navigation
Description
Problem or Motivation
Refine runs 390 s at p50 and 2,060 s at p99 on this repository, longer than the drain of 120 s. A rollout of the roadmap Service loses the item in progress. #3793 tries to prove refine writes across live rollouts; this item makes that case moot.
Proposed Solution & Architectural Design
- WorkflowTemplate
roadmap-refineruns the refine selection narrowed to one item (the option that the stage Job added, for refine). Template-level mutexrefine-<owner>.<name>-<n>. Semaphoreagent. Deadline 3,600 s on the template. Requests 200m and 768Mi, limits 1 CPU and 1.5Gi. Blobless clone. - No DAG chain: when refine sets an item Ready, the unit sets
roadmap:v1:due:<owner>/<name>:stage, and the next round creates the stage unit. - The refine row becomes a submit, as stage did.
- Keep the refine edit checks (
_body_unchanged_since_read,src/devops_cli/roadmap/refine/refine.py:2798). - Keep the spend telemetry of refine that the in-flight stage and refine spend work adds.
Removes: the in-pod body of _run_refine_adapter (src/devops_cli/roadmap/run.py:568-589), refine's use of model-clone.
When this item merges, close #3793 as superseded, with the evidence.
Target Subsystem
SDLC, Git & PR Governance (roadmap refine).
Existing Tool Considered
Argo Workflows mutex and semaphore, on the path of the stage unit. Cost: about 90,000 tokens and 4 hours to build, about 8,000 tokens a month to keep, about 15,000 tokens to fix.
Acceptance Criteria
- Live: a refine pod finishes while the Service rolls out.
- An item set Ready gets its stage unit within one round.
- A second refine unit of the same item does not start while one runs.
- Measure: refine rounds killed by a shutdown, 0 in 7 days.
Dependencies
- "feat(roadmap): keep plan records and record locks in Valkey".
- "feat(roadmap): keep schedules, intake and ledgers in Valkey".
- feat(k8s): let roadmap-service create Argo Workflows #6592 (let roadmap-service create Argo Workflows).
Source: #4517
Alternatives check of 2026-12-01: in-use.
The repository already uses this tool.
Tool: Argo Workflows (https://github.com/argoproj/argo-workflows), Apache-2.0, last activity 2026-12-01, maintained.
Reason: The search and the repository show that Argo Workflows runs one pod for each refine item from a WorkflowTemplate. It gives the mutex, the semaphore and the workflow deadline that the issue names. The project already runs it, so the remaining work is repository code.
Covers:
- One pod for each refine item from a WorkflowTemplate
- Template mutex and semaphore serialize units
- Workflow-level timeout holds the 3,600-second deadline
Lacks:
- The roadmap-refine template and its submit row
- The refine entrypoint narrowed to one item
- The edit checks and the spend telemetry of refine
Owner decision 2026-11-13
The approved pipeline split (tracker #5482, Phase 4) removes the due marks of refine: delete the stage_due stamp and the key roadmap:v1:due:*:stage. Stage derives Ready from the labels. Refine is due by its predicate in due_jobs, with the research barrier of #5513 when that ships. Semaphore agent.
- After feat(roadmap): the model container of a unit holds no credential #5506 merges, the unit uses the two-container template.
- Live proof: after the merge and the release, refine runs as the App in its own pod on the next due items. A comment gives the result lines, and 2 or fewer refine runs for each research result set.
Proposed design
Problem statement
Refine runs 390 s at p50 and 2,060 s at p99. That is longer than the 120 s drain. A rollout of the roadmap Service kills the refine round in progress.
This change runs each refine item in its own Argo Workflow pod from a roadmap-refine template. The refine row submits a unit. The edit checks and the spend telemetry stay. The stage due mark goes, per the owner decision of 2026-11-13. The live proof runs after the merge and the release.
Acceptance criteria
Requirement: Refine template passes the manifest checks
The roadmap-refine WorkflowTemplate SHALL pass the Kubernetes manifest checks of the repository.
Scenario: Manifest check of the refine template
- WHEN
uv run devops ci --check --only k8sruns on the branch that adds the template. - THEN The command exits 0 and reports no error for the manifests under
k8s/devops/roadmap-service/.
Requirement: Refine template holds its deadline, locks and budgets
The roadmap-refine WorkflowTemplate SHALL set the deadline, the mutex, the semaphore, the requests and the limits that the issue names.
Scenario: Rendered refine template
- WHEN
kubectl get workflowtemplate roadmap-refine -n devops -o jsonruns after the apply. - THEN The output shows
activeDeadlineSeconds3600, the mutexrefine-<owner>.<name>-<n>, the semaphoreagent, the requests 200m and 768Mi, and the limits 1 CPU and 1.5Gi.
Requirement: Blobless clone in the refine template
The roadmap-refine WorkflowTemplate MUST NOT run model-clone and SHALL clone the repository with git clone --filter=blob:none.
Scenario: Rendered refine clone
- WHEN
kubectl get workflowtemplate roadmap-refine -n devops -o yamlruns after the apply. - THEN The output holds
git clone --filter=blob:noneand holds nomodel-clone.
Requirement: Two-container refine unit
The roadmap-refine WorkflowTemplate SHALL run each unit in the two-container template that #5506 adds.
Scenario: Rendered refine template names
- WHEN
kubectl get workflowtemplate roadmap-refine -n devops -o jsonpath='{.spec.templates[*].name}'runs after the apply. - THEN The output holds the two-container template name that feat(roadmap): the model container of a unit holds no credential #5506 adds and no single-container refine step.
Requirement: Refine row submits a unit
The refine row SHALL create one Workflow from roadmap-refine for one due item and MUST NOT run a refine round in the Service process.
Scenario: Refine row runs for a due item
- WHEN The refine row runs in a test for one due item that has no live unit.
- THEN The Workflow client records one create call for that item and the test sees no call to
_run_refine_adapter.
Requirement: No owner reference to the Service
The refine Workflow MUST carry no owner reference to the Service Deployment, so a rollout of the Service does not end the unit.
Scenario: Create body of the refine unit
- WHEN The refine row builds the Workflow for a due item in a test.
- THEN
metadata.ownerReferencesof the create body is empty.
Requirement: Fixed refine unit name
The refine row SHALL name each unit from the repository reference, the refine row and the item, so a second create gets a conflict.
Scenario: Second create of the same item
- WHEN The refine row builds the unit for item 42 of
dan-petty/devops-clitwo times in a test. - THEN Both Workflow names are equal and the fake Workflow client returns a conflict for the second create.
Requirement: Refine unit narrows the selection
The refine unit SHALL run the refine selection for the one item that its Workflow names and MUST NOT write another item.
Scenario: Unit refines only its item
- WHEN The refine entrypoint runs in a test with
--item 42and two open New items, 42 and 43. - THEN The refine plan holds item 42 and not item 43.
Requirement: No stage due mark
The refine writer SHALL write no stage_due field and no roadmap:v1:due:<owner>/<name>:stage key when it sets an item Ready.
Scenario: Ready item writes no stage due mark
- WHEN The refine writer sets an item Ready in a test with a fake store.
- THEN The fake store records no write of
roadmap:v1:due:dan-petty/devops-cli:stageand the issue body holds nostage_duefield.
Requirement: Refine unit starts no stage unit
The refine unit MUST NOT create a stage Workflow when it sets an item Ready.
Scenario: Ready item starts no stage unit
- WHEN The refine unit sets an item Ready in a test with a fake Workflow client.
- THEN The fake Workflow client records no create call for a stage Workflow.
Requirement: Stage selects a Ready item from its label
The stage selection SHALL take a Ready item from its status/ready label and MUST NOT read a stage due mark.
Scenario: Stage selects a Ready item with no due key
- WHEN The stage row selects items in a test whose store holds one Ready item with
status/readyand no stage due key. - THEN The selection holds that item in that round and the stage row creates one stage unit for it.
Requirement: Edit checks kept
The refine pod SHALL call _body_unchanged_since_read and _outside_unchanged_since_read before its writes and MUST refuse a write whose body changed since the read.
Scenario: Body changed during the round
- WHEN The body hash at write time differs from the hash at read time in a test.
- THEN The write is refused, a warning names the item, and the fake store records no write.
Requirement: Refine spend telemetry kept
The refine unit SHALL record one spend row for each model request of the unit.
Scenario: A refine model request is recorded
- WHEN The refine investigation makes one model request in a test with a fake spend store.
- THEN The fake spend store holds one row for that request.
Requirement: Pending a person after the merge
After the merge and the release, a person MUST confirm that refine runs as the App in its own pod on the next due items.
Scenario: Live refine run after the release
- WHEN A person reads the next due refine units in the cluster after the release.
- THEN A comment on the issue gives the result lines and shows 2 or fewer refine runs for each research result set.
Existing Tool Considered
Argo Workflows (argoproj/argo-workflows), verdict in-use. The alternatives check of 2026-11-26 in the issue body gives what the tool covers and lacks. The repository already runs Argo Workflows, so this change adopts no new tool. This proposal adds the repository code that the check lists as lacking: the roadmap-refine WorkflowTemplate and its submit row, the pod entrypoint for one item, the edit checks and the spend telemetry. Written cost for that repository code: about 90,000 tokens and 4 hours to build, about 8,000 tokens a month to keep, and about 15,000 tokens to fix.
Key questions
- What does the owner decision of 2026-11-13 require?: It removes the due marks of refine. The refine writer writes no
stage_duefield and noroadmap:v1:due:<owner>/<name>:stagekey. Stage derives Ready from its labels. Refine is due by its predicate in the due jobs, with the research barrier of feat(roadmap): one research unit runs its steps just in time #5513 when that ships. The unit holds the semaphoreagent. After feat(roadmap): the model container of a unit holds no credential #5506 merges, the unit uses the two-container template. The live proof runs after the merge and the release. (best practice) [sources: docs/adr/0021-the-roadmap-service-is-a-webhook-router-cluster-pods-run-the-roadmap-jobs-and-valkey-holds-their-shared-state.md, src/devops_cli/roadmap/run.py:594, src/devops_cli/roadmap/refine/refine.py]- Chosen: Follow the owner decision: delete the stage due mark, use the due predicate, the
agentsemaphore and the two-container template after feat(roadmap): the model container of a unit holds no credential #5506. The owner decision of 2026-11-13 records the pipeline split and names these parts. - Rejected: Keep the
stage_duemark and the stage due key. The owner decision deletes the mark and the key. - Rejected: Chain refine to stage in one DAG. ADR 0021 says only the router and the sweep create units, and no DAG chain links two jobs.
- Chosen: Follow the owner decision: delete the stage due mark, use the due predicate, the
- Which code runs the refine round in the Service process today?: The refine row calls
_run_refine_adapteratsrc/devops_cli/roadmap/run.py:855. That adapter buildsRefineWriteratsrc/devops_cli/roadmap/refine/refine.py:4958and runs the round in the Service process. The body citessrc/devops_cli/roadmap/run.py:568-589, but that range does not hold the adapter. The change deletes the in-pod body and makes the row submit a unit. [sources: src/devops_cli/roadmap/run.py:855, src/devops_cli/roadmap/refine/refine.py:4958, tests/roadmap/test_roadmap_run_adapter_imports.py, tests/roadmap/refine/test_roadmap_refine_round.py] - How does the refine row submit one unit for one due item?: The refine row builds one Workflow from
roadmap-refinefor one due item. It creates the Workflow with the fixed unit name. The create body carries no owner reference to the Service Deployment, so a rollout does not end the pod. The pod clones the repository itself. (best practice) [sources: docs/adr/0021-the-roadmap-service-is-a-webhook-router-cluster-pods-run-the-roadmap-jobs-and-valkey-holds-their-shared-state.md, src/devops_cli/roadmap/run.py:855]- Chosen: Submit one Workflow for each due item from the refine row. ADR 0021 says only the router and the sweep create units, and a pod outlives a Service rollout.
- Rejected: Keep the refine round in the Service process. A rollout kills the round in progress, which is the problem of this item.
- Rejected: Submit one Workflow for all due items. ADR 0021 narrows a unit to one item, and a long batch passes the 3,600-second deadline.
- How does the refine unit narrow the selection to one item?: The Workflow passes the item number to the pod. The refine entrypoint runs the refine selection with
--itemfor that number, so every selection rule of the job applies. The unit writes no other item. (best practice) [sources: docs/adr/0021-the-roadmap-service-is-a-webhook-router-cluster-pods-run-the-roadmap-jobs-and-valkey-holds-their-shared-state.md, src/devops_cli/roadmap/refine/refine.py]- Chosen: Pass the item number as a Workflow parameter and run the selection with
--item. ADR 0021 keeps the--itemoption, and the row knows the item when it creates the unit. - Rejected: Let the pod read the due items and pick one. Two pods can pick the same item, and the mutex then serialises them for no gain.
- Chosen: Pass the item number as a Workflow parameter and run the selection with
- How does a second refine unit of the same item stay out?: The unit name is fixed by the repository reference, the refine row and the item, so a second create gets 409. The template also sets the mutex
refine-<owner>.<name>-<n>, and Argo Workflows holds it for the life of the pod. The semaphoreagentkeeps the cluster-wide model limit. (best practice) [sources: docs/adr/0021-the-roadmap-service-is-a-webhook-router-cluster-pods-run-the-roadmap-jobs-and-valkey-holds-their-shared-state.md, src/devops_cli/roadmap/run.py:855]- Chosen: Use a fixed unit name plus a template-level mutex. ADR 0021 records both the fixed name and the template-level mutex, and the repository reference gives the name form.
- Rejected: Use one global mutex. It serialises every item, so a refine unit waits behind an unrelated item.
- Rejected: Use an in-process lock in the Service. No refine round runs in the Service after this change.
- Are the body and outside edit checks kept, and where do they run?: Yes.
_body_unchanged_since_readis atsrc/devops_cli/roadmap/refine/refine.py:4586and_outside_unchanged_since_readis atsrc/devops_cli/roadmap/refine/refine.py:4596.RefineWriteratsrc/devops_cli/roadmap/refine/refine.py:4958runs them before its writes. The body citessrc/devops_cli/roadmap/refine/refine.py:2798, which is not the function. [sources: src/devops_cli/roadmap/refine/refine.py:4586, src/devops_cli/roadmap/refine/refine.py:4596, src/devops_cli/roadmap/refine/refine.py:4958] - What makes refine due after the owner decision?: The refine row keeps its cadence and its predicate in the due jobs. It also passes
_refine_cross_jobatsrc/devops_cli/roadmap/run.py:594. The unit writes no stage due mark. The research barrier of feat(roadmap): one research unit runs its steps just in time #5513 joins the predicate when it ships. (best practice) [sources: src/devops_cli/roadmap/run.py:594, docs/adr/0021-the-roadmap-service-is-a-webhook-router-cluster-pods-run-the-roadmap-jobs-and-valkey-holds-their-shared-state.md]- Chosen: Use the existing due predicate. The row already passes
_refine_cross_joband keeps its cadence. - Rejected: Keep the stage due mark as the refine trigger. The owner decision deletes the mark and the key.
- Rejected: Add the feat(roadmap): one research unit runs its steps just in time #5513 research barrier now. The owner decision makes the barrier conditional on when it ships.
- Chosen: Use the existing due predicate. The row already passes
- Which issues must be done before this item?: feat(roadmap): keep plan records and record locks in Valkey #4564 and feat(roadmap): keep schedules, intake and ledgers in Valkey #4565, the two Valkey steps that the body names by title, come first. feat(k8s): let Argo Workflows run roadmap pods in devops #4566, the engine step, comes first per ADR 0021 section 7. feat(roadmap): the model container of a unit holds no credential #5506, the two-container template, comes first per the owner decision. feat(k8s): let roadmap-service create Argo Workflows #6592, which lets roadmap-service create Argo Workflows, comes first per the body. feat(roadmap): one research unit runs its steps just in time #5513 is no dependency; its research barrier joins the refine due predicate when it ships. [sources: docs/adr/0021-the-roadmap-service-is-a-webhook-router-cluster-pods-run-the-roadmap-jobs-and-valkey-holds-their-shared-state.md, k8s/devops/roadmap-service/role.yaml, k8s/devops/roadmap-service/admissionpolicy.yaml]
- Which template does the refine unit use after feat(roadmap): the model container of a unit holds no credential #5506 merges?: The two-container template that feat(roadmap): the model container of a unit holds no credential #5506 adds: one job container and one model container that holds no credential. The admission policy at
k8s/devops/roadmap-service/admissionpolicy.yamladmits a stage Job with one container and no init container today, and feat(roadmap): the model container of a unit holds no credential #5506 changes the policy for the model container. (best practice) [sources: k8s/devops/roadmap-service/admissionpolicy.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: Use the two-container template after feat(roadmap): the model container of a unit holds no credential #5506. The owner decision names it, and feat(roadmap): the model container of a unit holds no credential #5506 makes the model container hold no credential.
- Rejected: Keep a single-container refine step. The owner decision replaces it after feat(roadmap): the model container of a unit holds no credential #5506.
- Rejected: Build a second refine template now. It duplicates feat(roadmap): the model container of a unit holds no credential #5506 and needs the same admission-policy change.
- Does the item close test(roadmap): verify refine writes across three live rollouts #3793 when it merges?: Yes. The pull request body holds
Closes #3793and the structural evidence: the renderedroadmap-refinesettings and an emptyownerReferenceson the Workflow. The live proof stays a criterion of this item and names a person after the merge. (best practice) [sources: src/devops_cli/roadmap/run.py:855, docs/adr/0021-the-roadmap-service-is-a-webhook-router-cluster-pods-run-the-roadmap-jobs-and-valkey-holds-their-shared-state.md]- Chosen: Close test(roadmap): verify refine writes across three live rollouts #3793 as superseded. test(roadmap): verify refine writes across three live rollouts #3793 proves a live rollout case for the refine round in the Service that this change removes.
- Rejected: Keep test(roadmap): verify refine writes across three live rollouts #3793 open. It would prove a case for a round that no longer runs in the Service.
Fit
Fits in one pull request.
Suspected block
None.
Activity
dan-petty commentedon Nov 11, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
featprefix of the title gives the type.(roadmap)scope of the title gives the scope.It removes a class of data loss during rollouts but depends on three other items and is not blocking a release.It eliminates item loss during Service rollouts and removes the need for the #3793 test.It adds Argo Workflows templates, mutex, semaphore, removes existing code, and depends on three other items.Both address refine surviving Service rollouts, but #3793 adds a verification test while this candidate changes the architecture to run each item in its own pod.devops-cli-service commentedon Nov 11, 2026
Refine cannot set this item to Ready at 4330ee4 while the items below stay open. The next refine round looks at the item again when they close, or when a person replies in a comment or edits the body.
devops-cli-service commentedon Nov 12, 2026
Alternatives check: in-use
Reason: The searches were thin on alternatives, but the repository facts show Argo Workflows is an open, actively maintained engine (Apache-2.0, latest release v4.1.6, not archived), and the issue itself records that its
synchronization.mutex,synchronization.semaphoreandactiveDeadlineSecondsalready give the per-item lock, the cluster-wideagentlimit and the 3,600-second deadline, while its templates already run the stage unit as a pod. What is left is repository-specific code (theroadmap-refinetemplate, the submit row, the pod entrypoint and the due mark), not a missing tool capability, so the tool covers the need and the issue already names it as the engine the project uses.The item already names this tool.
Tool: argoproj/argo-workflows (https://github.com/argoproj/argo-workflows)
Covers:
synchronization.mutexgives the per-item lock namedrefine-<owner>.<name>-<n>synchronization.semaphoregives the cluster-wideagentconcurrency limitactiveDeadlineSecondson a template gives the 3,600-second deadlineLacks:
roadmap-refineWorkflowTemplate exists in the repository yet; the project must write itroadmap:v1:due:<owner>/<name>:stagewritten when refine sets an item Ready_body_unchanged_since_readand_outside_unchanged_since_readedit checks; the refine code must carry themTools considered:
Searches run:
Sources:
Checked on 2026-11-12. A person decides what this means for the item. The check changes no label and closes no issue.
devops-cli-service commentedon Nov 14, 2026
Refine cannot set this item to Ready at 3d6cae6 while the items below stay open. The next refine round looks at the item again when they close, or when a person replies in a comment or edits the body.
devops-cli-service commentedon Nov 21, 2026
Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies and Watched files in the section Proposed design of the body.
fix(roadmap): an alternatives block names no blocker of an item (#6624)
devops-cli-service commentedon Nov 27, 2026
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.