Repository navigation
Description
Part of #5164 (child 12).
Problem or Motivation
The owner asked on 2026-11-12 to test a local model for a workflow that often succeeds at a small context window, and a frontier model for a workflow that fails (#5164). #5176 only says that a move is a candidate. Today a model change for a task is one settings change for all attempts (get_task_model, ai/client/factory.py; the Service ConfigMap sets the models). A wrong move drops the grade of the whole workflow, and nothing reverts it.
Intake already has a pattern: roadmap.intake.jev with off, shadow and on. In shadow, Jev answers the same fields and the job records both answers, and only the current path acts.
Proposed Solution & Architectural Design
- Setting
roadmap.model_trials: a list of trials. Each trial hastask,candidate(a gateway model or route),mode(shadoworshare),share(for example 0.2),min_attempts(30),max_days(7) andreason(localorfrontier). shadow(read-only steps: decision points, refine judge, alternatives, intake fields): the candidate answers the same request, the job records both results, and only the current model acts.share(steps that write: stage, implement, fix-plan, review): a stable hash of the item number sends the given share of attempts to the candidate model throughget_task_model. The result line getstrial=<name>andmodel=(feat(roadmap): eval grades shows success and context size per model #5176 givesmodel=).- Decision rule. After
min_attemptson each side, or atmax_days, compare the candidate with the current model: success withtest_proportions_2indep(as feat(roadmap): find a success or efficiency change after a release #5175), first pass, seconds and cost for each success (Mann-Whitney U).- Move: the candidate holds the grade of the current model (its Wilson lower bound is at or above the floor of that grade), and for
local, its cost or seconds for each success is not worse by more than 25%. - Revert: the candidate is worse with p < 0.05, or its 6-hour window has 5 or more attempts with 0 successes. A revert ends the trial at once.
- Move: the candidate holds the grade of the current model (its Wilson lower bound is at or above the floor of that grade), and for
- The trial never changes the setting of the task. A move is a pull request to the ConfigMap that a person merges; the grade-check step (feat(roadmap): a daily grade-check step keeps one issue per workflow #5173) files the proposal with the evidence.
- A frontier trial uses only the owner comparison set. A Sonnet trial waits for the owner to lift the hold of 2026-11-11.
Target Subsystem
AI & Agentic Review Pipeline (src/devops_cli/ai/client/factory.py) and SDLC, Git & PR Governance (src/devops_cli/roadmap/).
Existing Tool Considered
The LiteLLM gateway can split traffic between deployments of one model group by weight, but it does not know the attempt or its result, so it cannot give a trial result or revert. The intake Jev shadow mode is the pattern. statsmodels and SciPy give the tests. Cost: about 400,000 tokens, 10 hours elapsed, then one trial window of 7 days for each move.
Acceptance Criteria
- With a trial of share 0.2, about 20% of 100 fake items go to the candidate, and the same item goes to the same side each time.
- A
shadowtrial makes the candidate answer and records both, and only the current answer acts. - A fixture where the candidate is worse with p < 0.05 ends the trial and logs
revert. - A trial makes no change to the task setting.
Dependencies
#5176 (the measure for each model and the recommendation), #5175 (the compare tests).
Alternatives check of 2026-11-28: in-use.
The repository already uses this tool.
Tool: BerriAI/litellm (https://github.com/BerriAI/litellm), NOASSERTION, last activity 2026-11-28, maintained.
Reason: Searches found LiteLLM, the gateway the project already uses, which can weight traffic across deployments of one model group, but it knows no attempt or result, no stable item hashing, no shadow recording and no statistical revert.
Covers:
- Weighted traffic split across deployments of one model group
- OpenAI-compatible gateway for many providers
- Per-call cost tracking and spend logs
Lacks:
- No stable hash of the item number for a fixed side
- No shadow mode that records both answers
- No Wilson or two-proportion decision rule
- No automatic revert on a worse candidate
Proposed design
Problem statement
One settings change sets the model of a task for all of its attempts. A wrong move drops the grade of the whole workflow, and nothing reverts it. This item adds a trial. A candidate model answers a share of the attempts, or answers beside the current model in shadow mode. A decision rule moves the task to the candidate or reverts the trial. The trial never changes the setting of the task.
Acceptance criteria
Requirement: Model trial setting
The settings MUST accept a list of model trials under roadmap.model_trials, and each trial MUST name task, candidate, mode, share, min_attempts, max_days and reason.
Scenario: One share trial is loaded
- WHEN A settings source sets
roadmap.model_trialsto one trial withmode = share,share = 0.2andmin_attempts = 30. - THEN The loaded settings hold one trial with
mode = share,share = 0.2andmin_attempts = 30.
Requirement: Stable share routing
get_task_model SHALL return the candidate model for the share of the items that the trial names, and the same item MUST go to the same side on each call.
Scenario: Share 0.2 over 100 items
- WHEN A
sharetrial withshare = 0.2callsget_task_modelfor each of 100 item numbers, in two runs. - THEN 15 to 25 of the 100 items return the candidate model, and the two runs return the candidate model for the same items.
Requirement: Shadow records both answers
In shadow mode the job SHALL send the same request to the candidate and MUST record both answers, and only the answer of the current model SHALL act.
Scenario: A shadow trial at a decision point
- WHEN A decision point runs with a
shadowtrial of a candidate model. - THEN The result line holds the band of the current model and the band of the candidate, and the job applies the band of the current model.
Requirement: The trial changes no setting
A trial SHALL NOT change the model that the task configuration sets.
Scenario: A routed attempt leaves the settings alone
- WHEN A
sharetrial routes an item to the candidate and the step writes its result line. - THEN The model of the task in the loaded settings is the model that the settings source sets, and no settings file changed.
Requirement: Revert on a worse candidate
The decision rule MUST return revert and MUST end the trial at once when the candidate is worse with p < 0.05.
Scenario: The candidate is worse with p < 0.05
- WHEN A fixture gives each side at least
min_attemptsattempts and the two-proportion test returns p = 0.01 against the candidate. - THEN The rule returns
revert, and the trial record holdstrial=<name>andoutcome=revert.
Requirement: Revert on a window with no success
The decision rule MUST end a trial at once when the candidate has 5 or more attempts and no success inside 6 hours.
Scenario: Five attempts with no success inside 6 hours
- WHEN A fixture gives the candidate 5 attempts with 0 successes inside 6 hours.
- THEN The rule returns
revertand the trial ends.
Requirement: Move only when the grade holds
The decision rule SHALL return move only when the Wilson lower bound of the candidate is at or above the floor of the current model's grade and, for a local candidate, its cost or seconds for each success is not worse by more than 25%.
Scenario: A local candidate holds a grade-80 job at 20% more cost
- WHEN A fixture gives a local candidate 300 attempts with 270 successes (p = 0.90, Wilson lower bound 0.86) and a cost for each success 20% higher than the current model, whose grade is 80.
- THEN The rule returns
move, and the trial record holds the p-value and the interval that the rule read.
Requirement: Local move reaches grade 80
The decision rule MUST NOT return move for a local candidate whose point grade is below 80.
Scenario: A local candidate holds a grade-60 job at p 0.70
- WHEN A fixture gives a local candidate 300 attempts with 210 successes (p = 0.70, Wilson lower bound 0.645) while the current model's grade is 60.
- THEN The rule returns
continue, because the point grade is 70, below the 80 that the owner decision of 2026-11-16 requires for a move to the local model.
Requirement: Compare only after the minimum sample
The decision rule SHALL compare the two sides only after min_attempts attempts on each side, or at max_days, and MUST return continue before that.
Scenario: Ten attempts on each side
- WHEN A fixture gives each side 10 attempts and the trial sets
min_attempts = 30. - THEN The rule returns
continueand the trial stays open.
Requirement: Result line names the trial and the model
The result line of an attempt of a trial MUST hold trial=<name> and model=<model>.
Scenario: An attempt routed to the candidate
- WHEN A
sharetrial routes an item to the candidate and the step writes its result line. - THEN The line holds
trial=<name>andmodel=<candidate>.
Existing Tool Considered
The alternatives check of 2026-11-19 records the verdict in-use for BerriAI/litellm (https://github.com/BerriAI/litellm). The repository already uses this tool. The block of that check in the issue body gives the reason and lists what the tool covers and lacks. The proposal does what the tool lacks: it hashes the item number for a stable share, records both answers in shadow, and applies the statistical decision and the revert in get_task_model and the decision rule. The routing and the decision rule are new code: about 400,000 tokens and 10 hours elapsed, then one trial window of 7 days for each move.
Key questions
- Which libraries give the two-proportion test, the Wilson interval and the rank-sum test?: statsmodels 0.15.0 gives
test_proportions_2indepandproportion_confintwith methodwilson. It is already a direct dependency (pyproject.toml) and already gives the Wilson interval insrc/devops_cli/roadmap/job_grade.py. SciPy 1.18.1 is already in the lock through statsmodels (uv.lock) and givesmannwhitneyu. The change addsscipy==1.18.1topyproject.tomlbecause the code imports it directly. (best practice) [sources: pyproject.toml, src/devops_cli/roadmap/job_grade.py, uv.lock, docs/guidelines/agentic-jobs.md]- Chosen: statsmodels and SciPy. statsmodels is the locked statistics library and gives both proportion tests and the Wilson interval. SciPy is already locked through statsmodels and gives the rank-sum test.
- Rejected: A test written in this repository. Hand-written test code gives no checked p-value and needs its own tests to be trusted.
- Rejected: A bootstrap over the attempts. It gives no p-value that the 0.05 rule reads and no interval that the grade floor compares.
- How does the code send a stable share of the attempts to the candidate?: The code hashes the item number with SHA-256 and compares the low 32 bits with
share * 2**32, the same stable-hash pattern ashash_textinsrc/devops_cli/roadmap/body_hash.py.get_task_modelgains a keyword for the item number and the trial, so the factory picks the side for one call. The same item goes to the same side on each run, and a large set of items sends the given share to the candidate. (best practice) [sources: src/devops_cli/roadmap/body_hash.py:424, src/devops_cli/ai/client/factory.py:142]- Chosen: A stable hash of the item number. It needs no shared state and gives the same side for the same item on each run.
- Rejected: A random choice for each attempt. The same item would go to both sides, so the two sides hold no comparable attempts.
- Rejected: A counter in Valkey. It adds shared state and a second writer to the trial for no gain.
- Where does the decision rule read the attempts and their results?: The rule reads the result line of each attempt, which the job grade already reads (
docs/roadmap/job-success.md). The line names the trial intrial=<name>and the model inmodel=, and feat(roadmap): eval grades shows success and context size per model #5176 gives the measure of each model. The rule adds no store of its own. Its outcome goes in a trial record, a comment on the grade issue (docs/ROADMAP_WORKFLOW.md). (best practice) [sources: docs/roadmap/job-success.md, CONTEXT.md, docs/ROADMAP_WORKFLOW.md]- Chosen: The result lines of the attempts. The job grade already reads these lines, and feat(roadmap): eval grades shows success and context size per model #5176 gives the measure of each model from them.
- Rejected: A new table in Valkey. It holds a second copy of each result and needs a new writer and a new reader.
- Which steps take the
shadowmode and which take thesharemode?: A step whose answer the job can record twice without acting on the second takesshadow: the decision points, the refine judge, the alternatives check and the intake fields. A step that writes an artifact takesshare: stage, implement, fix-plan and review. A write step cannot hold two answers, because it writes once. (best practice) [sources: src/devops_cli/roadmap/refine/refine_judge.py, src/devops_cli/roadmap/alternatives.py, src/devops_cli/roadmap/steps/fix_plan.py, src/devops_cli/roadmap/steps/review.py, CONTEXT.md]- Chosen:
shadowfor recordable answers andsharefor written artifacts. A recordable answer can be sent twice, and a written artifact must act on one answer. - Rejected:
sharefor every step. The candidate answer would act on a step that can compare, so the job loses the current answer to compare. - Rejected:
shadowfor every step. A write step writes once, so it cannot record a second answer.
- Chosen:
- How does a
movebecome a change to the model of the task?: The decision rule writesmoveand its evidence in the trial record.docs/ROADMAP_WORKFLOW.mdputs a trial record in a comment on the grade issue of the job that feat(roadmap): a daily grade-check step keeps one issue per workflow #5173 files, or on tracker feat(roadmap): track job grades for each agentic workflow #5164 until that issue exists. The model of each job isai.tasks.<task>.modelof the ConfigMapdevops-cli-config(docs/CLUSTER.md), and the ConfigMap is not under Argo CD. A person changes it withkubectl -n devops patch configmap devops-cli-configand restarts the Service. This item writes no ConfigMap change and merges nothing. (best practice) [sources: docs/ROADMAP_WORKFLOW.md, docs/CLUSTER.md, k8s/devops/configmap.example.yaml]- Chosen: The trial record on the grade issue of feat(roadmap): a daily grade-check step keeps one issue per workflow #5173.
docs/ROADMAP_WORKFLOW.mdputs the trial record there, anddocs/CLUSTER.mdgives the ConfigMap as the one place that sets the task model. - Rejected: This item files the ConfigMap pull request. It repeats feat(roadmap): a daily grade-check step keeps one issue per workflow #5173 and needs the grade evidence that step collects.
- Chosen: The trial record on the grade issue of feat(roadmap): a daily grade-check step keeps one issue per workflow #5173.
- What grade must a local candidate reach before the decision rule returns
move?: The candidate must hold the current grade (Wilson lower bound at or above its floor) and, when it islocal, its point grade must be at least 80. The owner decision of 2026-11-16 lets a job move tolocal/qwen3.8:27bonly after its grade reaches 80% (k8s/devops/configmap.example.yaml;docs/CLUSTER.md). A local candidate at grade 70 does not move even when it matches a grade-60 current model. (best practice) [sources: k8s/devops/configmap.example.yaml, docs/CLUSTER.md]- Chosen: The point grade reaches 80 for a local candidate. It is the owner decision of 2026-11-16 that a job moves to the local model only at grade 80.
- Rejected: Hold the current grade only. It would move a grade-60 job to local at 0.60, which the owner decision forbids.
- Rejected: Grade 80 for every candidate. The owner decision names the local model. A candidate still has to hold the current grade, which may be above 80.
Fit
Fits in one pull request.
Suspected block
None.
Activity
dan-petty commentedon Nov 12, 2026
Both are children of #5164 and both deal with model tier; #5176 provides the per-model grade measure, while the candidate adds the routing, statistical comparison, and revert loop that uses that measure.devops-cli-service commentedon Nov 17, 2026
Refine cannot set this item to Ready at 8ccd95a 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 19, 2026
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 (10)
Tools considered:
Searches run:
Sources:
devops-cli-service commentedon Nov 26, 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.