Repository navigation
Description
Problem or Motivation
The approved pipeline split (tracker #5482, D2) builds no -n branch suffix now. On 2026-11-13 the owner gave the use of the suffix and its default:
- "the use case for branch-n is for future service job functionality that would run multiple simultaneous instances of the same job and then judge/compile a refined result".
- "sounds good, default will be one candidate for all jobs and no -n suffix is needed for that".
Today each job runs one attempt for each item. No job can run more than one attempt at the same time and then keep the best result or join the results. No measure shows if more attempts and a judge increase the success of a job enough to pay for the cost. Base (7 days to 2026-11-13, tracker #5482): stage 5 of 15 staged, implement 4 ready of 8 lines, refine 34 ready of 78 lines.
Proposed Solution & Architectural Design
- Setting.
roadmap.<job>.candidates, an integer. The default is 1 for all jobs. The ceiling is 4: the settings model refuses 0 and a value above 4. Only a person sets a value above 1, and only for a job where E6 shows a gain. - One candidate (the default). The job runs as it does today: one unit on the plain branch
<type>/<issue>-<slug>, with no suffix and no judge. The default path does not change. - N candidates (N above 1). The job runs N candidates at the same time. Candidate
i(1 to N) works on the branch<branch>-<i>. Scaffold (feat(roadmap): scaffold makes, resumes or adopts the item branch #5499) makes each candidate branch at the head of the plain branch. The resume rule of a candidate reads only its own branch, so scaffold never resumes or adopts a candidate branch as the plain branch. - Unit form. The candidates and the judge are steps of one Workflow of the job (feat(k8s): let Argo Workflows run roadmap pods in devops #4566): a parallel step over the N candidates, then the judge step. The item mutex
item-<repo>-<n>of feat(k8s): let Argo Workflows run roadmap pods in devops #4566 holds the item for the full Workflow, so N separate units of one item would wait for each other. The sweep creates the Workflow (no unit creates another unit). Each candidate step and the judge step is a pod with its own deadline and its own result line. - Judge. The judge step runs when all candidate steps end or reach their deadline. It compares the candidate results with the acceptance criteria of the item. It runs the checks of the job first (for example the stage gates or the implement checks) and calls a model only to compare candidates that pass the same checks. It takes the best candidate, or it joins parts of more than one candidate into one refined result. It writes that result to the plain branch through the push step (fix(roadmap): the final push of the implement Job can miss the latest main #4957). It writes one result line with the chosen candidates and the reason. With 0 usable candidates, it writes the result
failedand pushes nothing. - Check-out. The Workflow checks the item out for the job before work (the job, the Workflow name, the start and the deadline), as feat(roadmap): the poll frees the check-out of a gone job #5524 and owner decision (3) of 2026-11-13 state. Each candidate step writes its own check-out entry (the candidate number, the pod name, the start and the deadline) and checks in with its result. The poll of feat(roadmap): the poll frees the check-out of a gone job #5524 frees the entry of a missing, failed or late candidate pod and records its class (
evicted,deadline,failedorgone). The judge uses the candidates that checked in, and it checks the item in at its end write. - Branch cleanup. Cleanup (refactor(roadmap): run the stage cleanup in the status lane #5026) keeps the candidate branches
<branch>-<i>while the judge step of their item runs, and deletes them after the judge ends. The two-branch check of refactor(roadmap): run the stage cleanup in the status lane #5026 counts the plain branch and its candidate branches as one branch while the Workflow runs. - Cost rule. The cost of one attempt with N candidates is N times the cost of one attempt of the job, plus the cost of the judge. Each candidate line and the judge line state
tokensandcost_usd_micros(feat(roadmap): result lines state first-pass, model calls and cost #5168) and the fieldcandidates. The judge line also states the sum for the full attempt. - Experiment E6. E6 measures if N = 2 or N = 3 plus a judge increases the success of a job under band 80 enough to pay for the cost. Take the base grade of the job from
devops roadmap eval grades. Run the arms N = 1, N = 2 and N = 3 on the same items, with 30 or more attempts for each arm.devops roadmap eval gradesgives the grade of each arm by the fieldcandidates: the success, the Wilson interval, and thetokensandcost_usd_microsfor each success. The gain pays when the cost for each success of an arm is not above the cost for each success of N = 1 and the success interval of the arm is above the base. Else the owner decides if the gain pays for the extra cost. - If the estimate goes above 1 day, divide the work by the delivery rule of feat(roadmap): track the roadmap pipeline split into jobs #5482: (a) the setting, the branch forms and the cleanup rule; (b) the judge step; (c) E6.
Target Subsystem
Roadmap Service and roadmap jobs (src/devops_cli/roadmap/, k8s/devops/, docs/ROADMAP_WORKFLOW.md).
Acceptance Criteria
- Test first: with
candidates2, the sweep plans one Workflow with 2 candidate steps on<branch>-1and<branch>-2and one judge step after them. The test fails on the base. - A test: with
candidates1 (the default), the job makes one unit on the plain branch, no branch with a suffix and no judge step. - A test: the settings model refuses
candidates0 and a value above 4. - A test: the judge writes one result to the plain branch and names the candidates that it used. A failed or late candidate is not used, and the judge still runs with the other candidates. With 0 usable candidates, the judge writes
failedand pushes nothing. - A test: each candidate step writes its check-out entry before work and checks in at its end write. The poll of feat(roadmap): the poll frees the check-out of a gone job #5524 frees the entry of a missing candidate pod and records its class.
- A test: scaffold makes
<branch>-<i>for candidatei, and its resume rule does not resume or adopt a candidate branch as the plain branch. - A test: cleanup keeps the candidate branches while the judge step runs and deletes them after it. The two-branch check does not count them while the Workflow runs.
- A test: the
tokensandcost_usd_microsof the full attempt on the judge line are the sum of the candidate lines and the judge line. - A test:
devops roadmap eval gradesgives the grade of a job for each value ofcandidates. - A test:
--dry-runsends 0 requests. -
docs/ROADMAP_WORKFLOW.mdstates the setting, the branch forms, the judge, the cost rule and E6. - E6: for one job under band 80, a comment gives the success and the cost for each success of each arm, with n and the Wilson interval, and the decision for that job.
- Live proof: after the merge and the release, a person sets
candidatesto 2 for one job. The job runs as the App on one live item. A comment gives the result lines of both candidates and of the judge, and shows that cleanup deleted the candidate branches after the judge.
Existing Tool Considered
Argo Workflows v4.1.6 (installed, Apache-2.0) gives the fan-out and the fan-in: a steps template with withItems or withParam runs the candidate pods in parallel, and the next step runs after all of them end (continueOn with failed: true lets the judge run when one candidate fails). The item mutex, the deadlines and retryStrategy of #4566 apply. The pattern is best-of-N sampling with a judge. No open tool judges the results of the roadmap jobs: the judge reuses the checks of each job and the review code. Build: about 400,000 to 700,000 agent tokens and 1.5 to 2 days, divided as stated above.
Related
Part of #5482 (D2, Phase 7). Dependencies: #5499 (scaffold), #5504 (due_jobs), #4566 (Argo Workflows and the item mutex). Uses #5524 (check-out), #5026 (cleanup), #4957 (push step), #5168 (tokens and cost_usd_micros on each result line) and #5164 (job grades). Gap G31 of #5443 (branch runs).
Source: #5482
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: Searches found Argo Workflows for the parallel candidates and the fan-in. No open tool judges or joins the candidate results, so the project builds the judge.
Covers:
- Parallel steps with withItems or withParam
- Next step runs after all parallel steps end
- continueOn failed true keeps the judge running
- Step timeouts, retryStrategy and parallelism limits
- Exit hooks for the branch cleanup
Lacks:
- No judge that compares results with acceptance criteria
- No join of parts of several candidates
- No roadmap branch, check-out or cost fields
- No setting or eval grouping by candidate count
Proposed design
Problem statement
Each roadmap job runs one attempt for each item. This issue adds roadmap.<job>.branch_runs, parallel branch runs on suffixed branches, and a judge that selects or joins their results. The term is branch run, not candidate. The default stays one plain branch run with no judge. E6 measurement and the live proof need live runs and a person decision, so they are deferred.
Acceptance criteria
Requirement: Branch-run setting bounds
The roadmap settings model SHALL accept roadmap.<job>.branch_runs from 1 to 4 and default it to 1.
Scenario: Zero or above ceiling is refused
- WHEN a settings document sets
roadmap.stage.branch_runsto 0 or 5 - THEN the settings model raises a validation error that names the field and the range 1 to 4.
Requirement: Default branch run
With branch_runs 1, the sweep SHALL plan one unit on the plain branch and no judge step.
Scenario: Default path is unchanged
- WHEN the sweep plans a job for an item and
branch_runsis 1 - THEN the plan holds one unit on
<type>/<issue>-<slug>and no branch with a numeric suffix and no judge step.
Requirement: Two branch runs and a judge
With branch_runs 2, the sweep SHALL plan one Workflow with two branch-run steps and one judge step after them.
Scenario: Two branch runs fan out
- WHEN the sweep plans a job for an item and
branch_runsis 2 - THEN the Workflow holds two parallel branch-run steps on
<branch>-1and<branch>-2and one judge step that follows both.
Requirement: Scaffold branch form
Scaffold SHALL make <branch>-<i> for branch run i at the head of the plain branch.
Scenario: Resume reads only the plain branch
- WHEN the plain branch is absent and
<branch>-1exists - THEN scaffold makes the plain branch and does not adopt
<branch>-1as the plain branch.
Requirement: Workflow check-out
The Workflow SHALL check the item out for the job before work and SHALL check it in at its end write.
Scenario: Workflow check-out entry
- WHEN the Workflow starts for an item
- THEN its check-out entry holds the job, the Workflow name, the start and the deadline, and the judge's end write checks the item in.
Requirement: Branch-run check-out entry
Each branch-run step SHALL write its check-out entry before work and SHALL check in with its result.
Scenario: Branch-run check-out entry
- WHEN a branch-run step starts
- THEN its entry holds the branch-run number, the pod name, the start and the deadline, and its end write holds the result.
Requirement: Stale branch-run reclaim
The poll of #5524 SHALL free the entry of a missing, failed or late branch-run pod and record its class.
Scenario: Stale branch-run pod is reclaimed
- WHEN a branch-run pod disappears before it checks in and the poll runs
- THEN the poll frees the entry and records the class
gone.
Requirement: Judge uses usable branch runs
The judge step SHALL write one result to the plain branch and SHALL name each branch run that it uses.
Scenario: Failed branch run is skipped
- WHEN two branch runs end, one fails and one passes, and the judge step runs
- THEN the judge writes one result to the plain branch, names the passing branch run, and does not name the failed branch run.
Requirement: Judge checks before the model
The judge step SHALL run the deterministic checks of the job before it calls a model and SHALL call a model only to compare the branch runs that pass the same checks.
Scenario: A branch run that fails a check is not compared
- WHEN two branch runs end and one fails a job check
- THEN the judge names the failing branch run as unused and sends no model request to compare it.
Requirement: Judge joins parts
The judge step SHALL take the best branch run or join parts of more than one branch run into one refined result.
Scenario: Two branch runs each pass part of the checks
- WHEN branch run 1 passes the first check and branch run 2 passes the second
- THEN the judge writes one result that holds both parts and names both branch runs.
Requirement: Judge with no usable branch run
With no usable branch run, the judge SHALL write the result failed and SHALL push nothing.
Scenario: No branch run checks in
- WHEN no branch-run step checks in and the judge step runs
- THEN the judge writes the result
failedto its result line and pushes no branch.
Requirement: Cleanup keeps branch-run branches
Cleanup SHALL keep <branch>-<i> while the judge step of the item runs.
Scenario: Two-branch check during the Workflow
- WHEN the judge step runs and the two-branch check counts the branches
- THEN the plain branch and its branch-run branches count as one branch and no branch-run branch is deleted.
Requirement: Cleanup deletes branch-run branches
Cleanup SHALL delete the branch-run branches after the judge step ends.
Scenario: Judge end removes branch-run branches
- WHEN the judge step ends for the item
- THEN cleanup deletes
<branch>-1and<branch>-2and leaves the plain branch.
Requirement: Full attempt cost
The judge result line SHALL state tokens and cost_usd_micros for the full attempt as the sum of the branch-run lines and the judge line.
Scenario: Full attempt cost is summed
- WHEN two branch-run lines and the judge line hold their
tokensandcost_usd_micros - THEN the judge line holds the sum of the three values and the field
branch_runs.
Requirement: Dry run sends no request
The sweep SHALL send 0 requests when it runs with --dry-run.
Scenario: Dry run sends no request
- WHEN the sweep runs with
--dry-runandbranch_runsis 2 - THEN the command sends 0 GitHub requests and writes no branch.
Requirement: Workflow document covers branch runs
docs/ROADMAP_WORKFLOW.md SHALL state the setting, the branch forms, the judge and the cost rule.
Scenario: Workflow document covers branch runs
- WHEN the documentation test
tests/docs/test_roadmap_workflow_branch_runs.pyruns - THEN it passes and asserts the setting, the branch forms, the judge and the cost rule in
docs/ROADMAP_WORKFLOW.md.
Existing Tool Considered
Argo Workflows v4.1.6 (https://github.com/argoproj/argo-workflows), Apache-2.0, maintained, is in use; the block of the alternatives check of 2026-11-17 in the issue body gives what it lacks. The issue estimates the build at about 400,000 to 700,000 agent tokens and 1.5 to 2 days, so the work splits.
Key questions
- Which term and setting name does the project use for parallel attempts of one job?: Use
branch runandroadmap.<job>.branch_runs.CONTEXT.mddefines Branch run and lists candidate as a term to avoid. The result field isbranch_runs. (best practice) [sources: CONTEXT.md:173, CONTEXT.md:175]- Chosen: branch run and branch_runs. It matches the Branch run term in CONTEXT.md and avoids the Candidate term.
- Rejected: candidate and candidates. It clashes with the Candidate term in CONTEXT.md.
- What default and ceiling does
roadmap.<job>.branch_runshave?: The default is 1 for every job and the ceiling is 4. The settings model usesge=1andle=CONST_ROADMAP_LIMIT_CEILING_FACTOR * default, so it refuses 0 and a value above 4 with the name of the field. Only a person sets a value above 1, and only for a job where E6 shows a gain. (best practice) [sources: docs/guidelines/agentic-jobs.md:224, src/devops_cli/config/constants.py:3473, src/devops_cli/config/settings.py:1317]- Chosen: Default 1, ceiling 4. It keeps the current path, follows the one-attempt default of AW-J5 and bounds the cost with the project's 4-times-default ceiling.
- Rejected: Default 2, ceiling 4. It changes the default path and spends more tokens with no measured gain.
- Rejected: No ceiling. It lets a person set a cost with no bound.
- How does the sweep plan N branch runs and the judge?: The sweep plans one Workflow for the item. The Workflow holds a parallel step over the N branch runs and then one judge step. The item mutex
item-<repo>-<n>of feat(k8s): let Argo Workflows run roadmap pods in devops #4566 holds the item for the full Workflow. Each branch-run step and the judge step is a pod with its own deadline and result line. (best practice) [sources: docs/guidelines/agentic-jobs.md:50, docs/adr/0021-the-roadmap-service-is-a-webhook-router-cluster-pods-run-the-roadmap-jobs-and-valkey-holds-their-shared-state.md:67, docs/SERVICE_PATTERNS.md:52]- Chosen: One Workflow with parallel branch-run steps and a judge step. It uses the Argo Workflows fan-out and fan-in and keeps the item mutex for the full run.
- Rejected: N separate units of work. The item mutex makes the units wait for each other.
- How does the judge choose a result?: The judge step runs when all branch-run steps end or reach their deadline. It runs the deterministic checks of the job first and calls a model only to compare the branch runs that pass the same checks. It takes the best branch run or joins parts of more than one into one refined result. It writes that result to the plain branch through the push step and writes one result line with the chosen branch runs and the reason. With 0 usable branch runs it writes
failedand pushes nothing. (best practice) [sources: docs/guidelines/agentic-jobs.md:50, docs/guidelines/agentic-jobs.md:180, docs/adr/0020-a-decision-point-is-a-unit-of-a-workflow-with-a-resolver-chain-and-a-rule-goes-before-a-decision-model.md:34]- Chosen: Checks first, then a model for the branch runs that pass. It follows the guideline and ADR 0020: a rule answers first, and the model only compares where it adds something.
- Rejected: A model judges every branch run. It spends tokens on branch runs that a deterministic check already refuses.
- How does scaffold treat a branch-run branch?: Scaffold makes
<branch>-<i>for branch runiat the head of the plain branch. Its resume rule reads only the plain branch. It never resumes or adopts a branch-run branch as the plain branch. (best practice) [sources: CONTEXT.md:174, src/devops_cli/roadmap/steps/scaffold.py:146, openspec/changes/archive/2026-11-15-5499-scaffold-plan-branch/design.md:21]- Chosen: Suffixed branch at the plain-branch head. It keeps each branch run on its own branch and leaves the plain branch as the result.
- Rejected: Adopt a branch-run branch as the plain branch. It breaks the resume rule and mixes a branch run with the result.
- How do check-out and stale reclaim work for branch runs?: The Workflow checks the item out for the job before work, with the job, the Workflow name, the start and the deadline. Each branch-run step writes its own entry with the branch-run number, the pod name, the start and the deadline, and checks in with its result. The poll frees a missing, failed or late pod and records its class. The judge uses the branch runs that checked in and checks the item in at its end write. (best practice) [sources: docs/SERVICE_PATTERNS.md:54, docs/CLUSTER.md:88, src/devops_cli/roadmap/stage/stage_submit.py:8]
- Chosen: Per-branch-run check-out with the poll. It records each branch run and reclaims a stale pod.
- Rejected: One check-out for the Workflow only. It cannot tell a missing branch-run pod from a running one.
- When does cleanup delete the branch-run branches?: Cleanup keeps
<branch>-<i>while the judge step of the item runs and deletes them after the judge ends. The two-branch check counts the plain branch and its branch-run branches as one branch while the Workflow runs. A pushed branch with no mark is never judged by the stage cleanup, so the judge step must delete the branch-run branches explicitly. (best practice) [sources: CONTEXT.md:174, src/devops_cli/roadmap/stage/stage.py:3012, src/devops_cli/roadmap/stage/stage_submit.py:34]- Chosen: Keep until the judge ends, then delete. The judge can read each branch run and cleanup removes the temporary branches.
- Rejected: Delete when each branch-run step ends. The judge loses the branch-run result before it compares them.
- How are the cost fields of a branch run and the judge recorded?: Each branch-run line and the judge line state
tokensandcost_usd_microsand the fieldbranch_runs. The judge line states the sum for the full attempt. (best practice) [sources: src/devops_cli/roadmap/job_result.py:214, src/devops_cli/roadmap/job_result.py:234, docs/roadmap/job-success.md:20]- Chosen: Use the existing
tokensandcost_usd_microsfields. The result line already holds the cost fields. - Rejected: Add a new cost field. It duplicates the existing fields and breaks the cost readers.
- Chosen: Use the existing
- Which command gives the grade of each branch-run count?:
devops roadmap eval gradesgives the grade. E6 extends its grouping bybranch_runsand adds the success, the Wilson interval and the cost for each success. (best practice) [sources: docs/commands/roadmap.md:589, docs/roadmap/job-success.md:68, src/devops_cli/roadmap/job_grade_report.py]- Chosen: Extend
devops roadmap eval grades. The command already prints the job grade and reads the result lines. - Rejected: Add a new eval command. It duplicates the existing grade command.
- Chosen: Extend
- Can E6 and the live proof ship in the same pull request as the branch-run and judge code?: No. E6 needs 30 or more live attempts for each arm and an owner decision on the cost. The live proof needs the merge, the release and a person who sets the setting. Defer both to new issues. (best practice) [sources: docs/guidelines/agentic-jobs.md:79, docs/guidelines/agentic-jobs.md:210, docs/guidelines/agentic-jobs.md:225]
- Chosen: Defer E6 and the live proof. They wait on live runs and a person decision, and the code can ship without them.
- Rejected: Keep E6 and the live proof in the main issue. They cannot pass in the pull request and would block Ready.
Fit
Needs splitting into 2 items:
- feat(roadmap): add the branch-run setting, branch forms and cleanup
- feat(roadmap): add the branch-run judge
Suspected block
None.
Activity
dan-petty commentedon Nov 13, 2026
Both belong to the pipeline split; #5474 tracks the whole split while this item adds the candidates and judge step for one job.dan-petty commentedon Nov 13, 2026
Term clash: "candidate".
CONTEXT.mdgives "candidate" one meaning: an issue that intake has not placed. PR #5489 adds the term Branch run for one of the parallel runs of one job, with "candidate" in its_Avoid_line, and the agentic jobs guideline uses "parallel runs". This item names the settingroadmap.<job>.candidatesand the runs "candidates".Use one term before the build starts: for example
roadmap.<job>.branch_runsand "branch run" in the code, the result line field and the docs. Else change the term inCONTEXT.mdin the same pull request (AGENTS.md rule 8).devops-cli-service commentedon Nov 17, 2026
Alternatives check: in-use
Reason: Searches found no open tool that judges or refines roadmap job results; Argo Workflows, already installed and chosen by ADR 0008, supplies only the parallel candidate fan-out and the ordered judge step, so the judge itself stays project work.
The repository already uses this tool.
Tool: argoproj/argo-workflows (https://github.com/argoproj/argo-workflows), Apache-2.0, last activity 2026-11-17, maintained.
Covers:
Lacks:
Searches (9)
Tools considered:
Searches run:
Sources:
A person decides what this check of 2026-11-17 means for the item.
devops-cli-service commentedon Nov 18, 2026
The proposal at 86358b6 needs splitting into 2 items. A person splits the item into the items below, or replies in a comment or edits the body to keep one item, and the next refine round looks at the item again.