Repository navigation
Description
Problem or Motivation
The stage job plans every item with one model tier and decides nothing about cost before the first plan call. A read-only study of TypeSafe Jev 1.14 (2026-11-09) found that route_with_jev (src/devops_cli/ai/jev.py, PR #4275) can give a tier choice before a plan call: Choice {deepseek flash, sonnet}, Score complexity 0-3, Noul high_risk, and one Noul question "the item names concrete files and criteria". The input is the issue body plus the facts, about 3K tokens, so one call costs about 0.0001 USD (0.042 USD per million input tokens).
No data says whether the Jev choice predicts failure or cost. Switching the tier on the strength of the study alone would be a guess.
Proposed Solution
Shadow mode only. In _Planner, before the first plan call of an item, when roadmap.stage.jev_shadow is on, call route_with_jev and LOG the decision next to the real result: one log line per item (item, choice, complexity, high_risk, concrete-files probability) and one counter devops_cli_roadmap_stage_jev_total with the single label choice (values deepseek and sonnet, plus error): 3 series. The change decides NOTHING: no item is left out, no model changes, no comment is added. A Jev error is logged and counted as error, and the item goes on as before.
After 7 days a person compares the Jev choice with the real result: failed against staged, and USD per tier.
Acceptance Criteria
uv run devops ci test tests/roadmap/stage/test_stage_jev_shadow.pypasses. It fails today because the module does not exist. It uses a fake Jev and makes no network call.- With the switch off, no Jev call is made (test).
- With the switch on, the log line and the counter are made, and the plan result, the model and the item list are equal to the run with the switch off (test).
- A Jev error does not stop the item (test).
- The series count of the new metric is stated in the README metric table (
uv run devops docs generate --sync-readme).
Existing tool considered
route_with_jev exists in src/devops_cli/ai/jev.py; this work reuses it. The one new question (concrete files and criteria) is a small addition to that module or a call that passes its own question set.
Cost
Build: one switch, one call site, one counter, tests. Run: about 0.0001 USD for each item. The data decides later whether Jev may change the tier.
Related
Proposed design
Problem statement
The stage job plans every item with one model tier and decides nothing about cost before the first plan call. No data shows whether the Jev tier choice predicts failure or cost. Add a shadow mode that logs and counts the Jev choice beside each stage run, so a person can compare it with the real result after 7 days. The mode changes no stage behaviour. A reply on the issue found that no live Jev request can pass through the LLM gateway today, so the item waits on #4289.
Acceptance criteria
Requirement: Switch off makes no Jev call
The stage job SHALL make no Jev call when roadmap.stage.jev_shadow is off.
Scenario: Switch off
- WHEN A stage round plans an item with
roadmap.stage.jev_shadowoff and a fake Jev that records its calls - THEN The fake Jev records zero calls, and no log line and no counter sample for the metric exist.
Requirement: Switch on logs and counts the choice
The stage job SHALL log one line for each item and SHALL increment devops_cli_roadmap_stage_jev_total once with the label choice before the first plan call, when roadmap.stage.jev_shadow is on.
Scenario: Switch on
- WHEN A stage round plans an item with the switch on and a fake Jev that picks the sonnet tier
- THEN One log line holds the item, the choice, the complexity,
high_riskand the concrete-files probability, and the counter withchoice=sonnetis 1.
Requirement: Shadow mode changes nothing
The stage job SHALL produce the same plan result, the same model and the same item list with the switch on as with the switch off.
Scenario: Result equals the run with the switch off
- WHEN The same fake items run twice, once with the switch off and once with the switch on
- THEN The plan result, the model name of each plan call and the item list are equal in both runs, and no comment is added.
Requirement: Jev error does not stop the item
The stage job MUST log a Jev error, MUST count it with choice=error and MUST continue to plan the item as before.
Scenario: Jev raises an error
- WHEN The fake Jev raises an exception and the switch is on
- THEN The counter with
choice=erroris 1, the log holds the error, and the item is planned with the same result as with the switch off.
Requirement: Metric has three series
The metric devops_cli_roadmap_stage_jev_total SHALL have the single label choice with only the values deepseek, sonnet and error, and the README metric table SHALL state 3 series.
Scenario: README sync
- WHEN
uv run devops docs generate --sync-readmeruns - THEN The README metric table lists the metric with 3 series, and the docs check passes.
Requirement: Test module runs offline
The test module tests/roadmap/stage/test_stage_jev_shadow.py SHALL pass with uv run devops ci test and SHALL make no network call.
Scenario: Offline run
- WHEN The test module runs with a fake Jev and no network
- THEN All tests pass, and the module fails before the change because it does not exist.
Existing Tool Considered
route_with_jev in src/devops_cli/ai/jev.py (TypeSafe Jev) covers the tier choice, the complexity score and the high_risk probability, and this work reuses it. It lacks the question "the item names concrete files and criteria", so the change adds one optional question parameter. The counter uses Instrument and emit in src/devops_cli/telemetry/instruments.py, so no new library is needed. No alternatives check has run. Build cost: one switch, one call site, one counter and tests, about one small pull request. Run cost: about 0.0001 USD for each item.
Key questions
- Which function gives the tier choice, the complexity and the high-risk probability?:
route_with_jevreturns aJevRouteDecisionwithpicked_model,selected_model,complexity_scoreandhigh_risk_probability. It sends one parallel decision request throughdecide_with_jev. [sources: src/devops_cli/ai/jev.py] - Can a call of
route_with_jevrun inside a running event loop?: Yes.decide_with_jevruns each request on one anyio blocking portal, so it works from any thread, also from a thread with a running loop. The helper still catches every exception and countserror. [sources: src/devops_cli/ai/jev.py] - How does the shadow call add the concrete-files question?: Add an optional keyword parameter
extra_questionstoroute_with_jev. It adds the questions to the request and returns their Noul probabilities in a new fieldextra_probabilitieswith an empty default. Existing callers stay valid. (best practice) [sources: src/devops_cli/ai/jev.py]- Chosen: Optional
extra_questionsparameter onroute_with_jev. It reuses the tested routing code and keeps one request and one call. - Rejected: Second Jev call with its own question. It doubles the calls and the cost.
- Rejected: New routing function in the stage module. It duplicates the code of
route_with_jev.
- Chosen: Optional
- Which value does the
choicelabel take?: Usepicked_modelof the decision, the raw Jev choice, notselected_model, which holds the escalation. Map it todeepseekorsonnet. Useerrorwhen the call fails. (best practice) [sources: src/devops_cli/ai/jev.py]- Chosen:
picked_modelmapped todeepseekorsonnet. It records what Jev chose, which is the data that a person compares, and keeps 3 series. - Rejected:
selected_modelafter escalation. It hides the raw choice. The escalation fields are in the log line already.
- Chosen:
- Where does the call run and how does a Jev error stay contained?: The call runs in
_Planner.planbefore the first plan call of an item and only when the item has no kept plan hit. One helper catches every exception, logs it, countserrorand returns. The counter follows the emit pattern ofROADMAP_STAGE_PLAN_RECORD_TOTAL. (best practice) [sources: src/devops_cli/roadmap/stage/stage.py, src/devops_cli/telemetry/instruments.py]- Chosen: One helper with a catch-all that logs and counts. A Jev error never stops the item, and it follows the existing emit pattern.
- Rejected: Let the error pass to the stage job. It would change stage behaviour, which shadow mode forbids.
- Where does the switch
roadmap.stage.jev_shadowlive and what is its default?: Add a booleanjev_shadowtoRoadmapStageConfig, default False, besidejev_completeness. Regeneratedocs/ENV_VARS.mdanddocs/CONFIGURATION.mdwithuv run devops docs generate --sync-readme. (best practice) [sources: src/devops_cli/config/settings.py, docs/ENV_VARS.md, docs/CONFIGURATION.md]- Chosen: Boolean setting, default off. It follows the pattern of
roadmap.stage.jev_completeness, and shadow mode must cost nothing until a person turns it on. - Rejected: Default on. It spends tokens and adds a hosted call without consent.
- Chosen: Boolean setting, default off. It follows the pattern of
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
Alternatives check of 2026-11-10: in-use.
The item already names this tool.
Tool: dan-petty/devops-cli (https://github.com/dan-petty/devops-cli), MIT, last activity 2026-11-10, maintained.
Activity
dan-petty commentedon Nov 9, 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.Shadow-mode logging that decides nothing and informs a future 7-day review is not urgent.It collects the data needed to decide whether Jev may change the tier, but changes no user-facing behaviour today.One switch, one call site, one counter, a test file, and a README metric row.Both call route_with_jev in the roadmap stage pipeline, but the candidate logs a tier choice before the plan call while #4282 screens a plan before the verify step.devops-cli-service commentedon Nov 9, 2026
Status set to Ready at 84117ac (see proposed design in issue body).
dan-petty commentedon Nov 9, 2026
Premise check on 2026-11-09 (AGENTS.md rule 2). The item needs TypeSafe Jev to answer a Decisions request through the LLM gateway. It cannot.
POST /v1/systemoneon the gateway (the path thatSystemOneModelposts to) answered HTTP 404. The OpenAPI document of the gateway lists nosystemoneordecisionspath.POST /v1/chat/completionswith the modeltypesafe/jev-1.14answered HTTP 400: "typesafe/jev-1.14 is a decisions model and cannot be used with the chat/completions endpoint. Use the /api/alpha/decisions endpoint instead."k8s/llm/gateway/config.yamlserves the model asopenrouter/typesafe/jev-1.14, a chat route in LiteLLM.So no live Jev request can pass, and the offline comparison on the golden set could not run. The route problem is issue #4289. The code and its tests are on a local branch, built against a fake Jev, and are not in a pull request. A person must decide how Jev is reached (a gateway pass-through, the TypeSafe API with its own key, or no Jev). The item can go on after that.
devops-cli-service commentedon Nov 10, 2026
Status set to Ready at f8bd761 (see proposed design in issue body).
devops-cli-service commentedon Nov 10, 2026
Alternatives check: in-use
Reason: The tier choice the issue wants to log already exists as
route_with_jevin the project's own repository (src/devops_cli/ai/jev.py): one decisions call returns the picked model, the complexity score and the high-risk probability, and the issue reuses it rather than adding a router. It does not cover the whole item, because the shadow-mode switch, the log line, thedevops_cli_roadmap_stage_jev_totalcounter and the extra "names concrete files and criteria" question must still be added, and the hosted Jev model is not reachable through the LLM gateway today.The item already names this tool.
Tool: dan-petty/devops-cli (https://github.com/dan-petty/devops-cli)
Covers:
picked_model) from one decisions callhigh_riskNoul probabilityLacks:
roadmap.stage.jev_shadow), no per-item log line and nodevops_cli_roadmap_stage_jev_totalcounter with thechoicelabelextra_questionsparameter and anextra_probabilitiesfieldTools considered:
Searches run:
Sources:
Checked on 2026-11-10. A person decides what this means for the item. The check changes no label and closes no issue.
refactor(ai): Remove the unused Jev helpers (#5839)
devops-cli-service commentedon Nov 17, 2026
Released in v0.172.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.172.0
devops-cli-service commentedon Nov 17, 2026
Live since 2026-11-17 12:22 UTC