Skip to content

feat(roadmap): log a Jev tier choice beside each stage run #4284

Closed

Description

@dan-petty

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.py passes. 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

#4274, #4275, #4204.

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_shadow off 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_risk and the concrete-files probability, and the counter with choice=sonnet is 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=error is 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-readme runs
  • 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_jev returns a JevRouteDecision with picked_model, selected_model, complexity_score and high_risk_probability. It sends one parallel decision request through decide_with_jev. [sources: src/devops_cli/ai/jev.py]
  • Can a call of route_with_jev run inside a running event loop?: Yes. decide_with_jev runs 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 counts error. [sources: src/devops_cli/ai/jev.py]
  • How does the shadow call add the concrete-files question?: Add an optional keyword parameter extra_questions to route_with_jev. It adds the questions to the request and returns their Noul probabilities in a new field extra_probabilities with an empty default. Existing callers stay valid. (best practice) [sources: src/devops_cli/ai/jev.py]
    • Chosen: Optional extra_questions parameter on route_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.
  • Which value does the choice label take?: Use picked_model of the decision, the raw Jev choice, not selected_model, which holds the escalation. Map it to deepseek or sonnet. Use error when the call fails. (best practice) [sources: src/devops_cli/ai/jev.py]
    • Chosen: picked_model mapped to deepseek or sonnet. It records what Jev chose, which is the data that a person compares, and keeps 3 series.
    • Rejected: selected_model after escalation. It hides the raw choice. The escalation fields are in the log line already.
  • Where does the call run and how does a Jev error stay contained?: The call runs in _Planner.plan before the first plan call of an item and only when the item has no kept plan hit. One helper catches every exception, logs it, counts error and returns. The counter follows the emit pattern of ROADMAP_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_shadow live and what is its default?: Add a boolean jev_shadow to RoadmapStageConfig, default False, beside jev_completeness. Regenerate docs/ENV_VARS.md and docs/CONFIGURATION.md with uv 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.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#4289

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

  1. added
    source/agent
    type/feature
    scope/roadmap
    status/new
    value/medium
    effort/low
    on Nov 9, 2026
  2. dan-petty commented on Nov 9, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/feature. The feat prefix of the title gives the type.
    • Scope: scope/roadmap. The (roadmap) scope of the title gives the scope.
    • Priority: P3-Low. Shadow-mode logging that decides nothing and informs a future 7-day review is not urgent.
    • Value: Medium. It collects the data needed to decide whether Jev may change the tier, but changes no user-facing behaviour today.
    • Effort: Low. One switch, one call site, one counter, a test file, and a README metric row.
    • Related: feat(roadmap): a Jev screen before the verify step #4282, which asks for a different change. 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.
  3. added
    priority/p3-low
    on Nov 9, 2026
  4. added
    status/ready
    and removed
    status/new
    on Nov 9, 2026
  5. devops-cli-service commented on Nov 9, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at 84117ac (see proposed design in issue body).

  6. dan-petty commented on Nov 9, 2026

    @dan-petty
    OwnerAuthor

    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/systemone on the gateway (the path that SystemOneModel posts to) answered HTTP 404. The OpenAPI document of the gateway lists no systemone or decisions path.
    • POST /v1/chat/completions with the model typesafe/jev-1.14 answered 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.yaml serves the model as openrouter/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.

  7. added
    status/new
    and removed
    status/ready
    on Nov 9, 2026
  8. added
    status/ready
    and removed
    status/new
    on Nov 10, 2026
  9. devops-cli-service commented on Nov 10, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at f8bd761 (see proposed design in issue body).

  10. devops-cli-service commented on Nov 10, 2026

    @devops-cli-service
    Contributor

    Alternatives check: in-use

    Reason: The tier choice the issue wants to log already exists as route_with_jev in 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, the devops_cli_roadmap_stage_jev_total counter 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)

    • License: MIT
    • Last activity: 2026-11-10
    • Maintained: yes

    Covers:

    • Returns the Jev tier choice (picked_model) from one decisions call
    • Returns the complexity score (0-3) and the high_risk Noul probability
    • Runs from a thread with a running event loop via one anyio blocking portal, so it fits the planner call site
    • Already in the project and named by the issue as the function this work reuses

    Lacks:

    • No shadow-mode switch (roadmap.stage.jev_shadow), no per-item log line and no devops_cli_roadmap_stage_jev_total counter with the choice label
    • No question for "the item names concrete files and criteria"; the issue plans an optional extra_questions parameter and an extra_probabilities field
    • No reachable hosted Jev through the LLM gateway: the decisions path answers 404/400, so the live call is blocked on fix(ai): the gateway has no route for the Jev Decisions API #4289

    Tools considered:

    Searches run:

    • open source LLM router choose model tier by query complexity shadow mode, results: 5
    • TypeSafe Jev decisions model, results: 5
    • TypeSafe AI Jev System One model typed decisions documentation, results: 5
    • RouteLLM github open source LLM routing cost quality, results: 5
    • "typesafe" Jev "System One" SDK github python systemone, results: 5
    • "jev-router" github TypeSafe decisions routing, results: 5
    • typesafe.ai Jev decisions API pricing per million tokens, results: 5
    • TypeSafe AI Jev decision model API key systemone, results: 5
    • Jev model typed decisions alternatives open source decision model server, results: 5
    • systemone typesafe python package decisions, results: 5

    Sources:

    Checked on 2026-11-10. A person decides what this means for the item. The check changes no label and closes no issue.

  11. added
    status/in-review
    and removed
    status/ready
    on Nov 17, 2026
  12. removed
    status/in-review
    on Nov 17, 2026
  13. devops-cli-service commented on Nov 17, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-17 12:22 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/lowpriority/p3-lowscope/roadmapsource/agenttype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions