Skip to content

feat(roadmap): a Jev screen before the verify step #4282

Closed

Description

@dan-petty

Problem or Motivation

The model review of a plan (stage_verify.verify(), refine_judge.judge()) is the costliest model step before a draft opens. In the stage job it is an agent with read tools. It runs for every plan, also for a plan with no defect. Evidence from a read-only study of TypeSafe Jev 1.14 (2026-11-09):

  • Jev (typesafe/jev-1.14, a System One decision model; src/devops_cli/ai/jev.py, PR feat(ai): integrate Jev 1.14 and agent configurations #4275) answers many typed questions about one text in one request, with a calibrated probability for each Noul question. It costs 0.042 USD per million input tokens. The gateway route is healthy.
  • The review input (issue plus plan, VerificationInput) averages 4.1K tokens and is 51K tokens at most (30 cited files). One Jev request with 9 Noul questions (one for each type in VERIFY_TYPES) and 1 Score question (plan quality) costs about 0.0002 USD on average. The whole golden set costs about 0.02 USD.
  • refine_judge.judge() sends the same input as Jev reads, with no tool, so Jev can stand in its place as the first screen.
  • The golden set tests/fixtures/roadmap_eval/stage has 56 directories: 51 cases with 317 labelled defects and 5 good plans. A stored run of the reviewer alone exists (.data/roadmap_eval/verify/20261105T203919Z.json, model claude-sonnet-5-5, 44 cases, recall 27%, serious recall 38%).

The idea: a cascade. If every open-type probability is below a low threshold, skip the tool-using reviewer. Otherwise run it as today. Jev never approves alone and never rejects. Any Jev error, timeout or low confidence means: run the reviewer (fail open).

Weak point: the set has only 5 good plans, so it cannot show the false-positive rate of the screen. The measure must say this.

Proposed Solution

Add roadmap.stage.jev_screen (bool, default false) and a function in stage_verify.py that builds the 10-question DecisionRequest for a VerificationInput, reusing create_jev_model and _run_decide of jev.py. _Planner._review and refine_judge.judge call it first. With the switch off, nothing changes. Score the cascade offline on the golden set with the existing scorer (stage_verify_eval: TypeRecall, serious_recall, good_returning), by type (Jev gives no quote). Turn the switch on only after a person reads the comparison.

Acceptance Criteria

  • uv run devops ci test tests/roadmap/stage/test_stage_verify_jev.py passes. It fails today because the module does not exist. It uses a fake Jev and makes no network call.
  • With roadmap.stage.jev_screen off, the reviewer runs for every plan (test).
  • With the switch on and all open-type probabilities below the threshold, the reviewer is not called. With one at or above it, the reviewer is called. With a Jev error, the reviewer is called, and the error is logged (tests).
  • The pull request comment holds the offline comparison on the golden set: recall and serious recall with and without the cascade, the share of skipped reviews and the spend.
  • uv run devops docs generate --sync-readme shows the new setting.

Existing tool considered

src/devops_cli/ai/jev.py exists (create_jev_model, _run_decide, judge_with_jev). This work reuses it and builds no second client. judge_with_jev has a fixed rubric question set, so a new request builder for the 9 defect types is needed.

Cost

Build: one function, one setting, two call sites and tests. Run: about 0.0002 USD for each screened plan; it saves one agent run (several requests, thousands of tokens) for each skipped plan. Spend of the offline comparison: about 0.02 USD.

Related

#4274, #4275, #4204, #3153, #3039, #3502.

Proposed design

Problem statement

The model review of a plan, stage_verify.verify() and refine_judge.judge(), is the costliest model step before a draft opens. It runs for every plan, also for a plan with no defect. A cheap Jev screen can skip the review when no open defect type looks likely. Jev never approves or rejects alone, and any Jev error runs the reviewer as today. A premise check found that the gateway has no live Jev route today (issue #4289). This item therefore builds the screen against a fake Jev and keeps the switch off. The comparison on the golden set moves to a new issue.

Acceptance criteria

Requirement: Switch off keeps today's behaviour

With roadmap.stage.jev_screen set to false, the system SHALL run the reviewer for every plan and SHALL make no Jev call.

Scenario: switch off

  • WHEN jev_screen is false and a fake Jev counts its calls
  • THEN The reviewer runs once and the fake Jev gets zero calls.

Requirement: Screen skips a clean plan

With the switch on and every open-type probability below the threshold, the system SHALL NOT call the reviewer.

Scenario: all probabilities low

  • WHEN jev_screen is true and the fake Jev returns a probability below the threshold for every open type
  • THEN The reviewer is not called and the plan passes with no findings.

Requirement: Screen runs the reviewer on a risky plan

With the switch on and one open-type probability at or above the threshold, the system SHALL call the reviewer.

Scenario: one probability at threshold

  • WHEN jev_screen is true and the fake Jev returns a probability equal to the threshold for one open type
  • THEN The reviewer is called once.

Requirement: Screen fails open

When Jev raises an error, times out, leaves an open-type question unanswered or returns a probability that is not a number, the system SHALL call the reviewer and SHALL log the error.

Scenario: Jev error

  • WHEN jev_screen is true and the fake Jev raises an exception
  • THEN The reviewer is called and one log record names the error.

Requirement: Score never gates

The Score answer for plan quality SHALL NOT change whether the reviewer runs.

Scenario: score ignored

  • WHEN jev_screen is true, every open-type probability is below the threshold, and the fake Jev returns a very low plan quality score
  • THEN The reviewer is not called. With a very high score and one open-type probability at the threshold, the reviewer is called.

Requirement: Ten-question request

The request builder SHALL build one DecisionRequest with one Noul question for each type in VERIFY_TYPES and one Score question for plan quality.

Scenario: request shape

  • WHEN The builder gets a VerificationInput
  • THEN The request holds 10 questions: 9 Noul questions, one for each defect type, and 1 Score question.

Requirement: Both call sites use the screen

Both _Planner._review and refine_judge.judge SHALL call the screen before the reviewer.

Scenario: two call sites

  • WHEN jev_screen is true and the fake Jev returns low probabilities
  • THEN Neither _Planner._review nor refine_judge.judge calls its reviewer.

Requirement: Threshold is a named constant

The screen SHALL read its threshold from one constant in src/devops_cli/config/constants.py and SHALL NOT reuse CONST_AI_JEV_DEFAULT_BOOLEAN_THRESHOLD.

Scenario: constant used

  • WHEN A test sets the fake Jev probability just below and just at the constant
  • THEN The reviewer is skipped below the constant and called at the constant.

Requirement: Setting is documented

The setting roadmap.stage.jev_screen SHALL appear in the generated documentation with default false.

Scenario: docs sync

  • WHEN uv run devops docs generate --sync-readme runs
  • THEN The output shows roadmap.stage.jev_screen and no check reports drift.

Requirement: Test module runs offline

The module tests/roadmap/stage/test_stage_verify_jev.py SHALL pass with a fake Jev and no network call.

Scenario: offline test run

  • WHEN uv run devops ci test tests/roadmap/stage/test_stage_verify_jev.py runs with the network blocked
  • THEN All tests pass.

Existing Tool Considered

The tool is TypeSafe Jev 1.14 through the pydantic_ai DecisionModel, already wrapped in src/devops_cli/ai/jev.py (create_jev_model, _run_decide). This work reuses it and builds no second client. It lacks a request for the 9 defect types, because judge_with_jev has a fixed rubric question set. It also gives no quote, so the offline score works by type. No alternatives check has run. The new code is one request builder, one setting, one constant, two call sites and tests. The cost is a small number of tokens to build and fix it, in one pull request.

Key questions

  • Which existing code does the screen reuse?: It reuses create_jev_model and _run_decide of jev.py, and adds only the request builder in stage_verify.py. The builder takes the decision model as an argument, as the other functions of jev.py do, so a test passes a fake. [sources: src/devops_cli/ai/jev.py, src/devops_cli/roadmap/stage/stage_verify.py]
  • Which probabilities gate the skip?: Only the Noul questions of the open types (OPEN_TYPES) gate the skip. The other types in VERIFY_TYPES are asked but do not gate, because a finding of those types is advice and not a blocking finding. (best practice) [sources: src/devops_cli/roadmap/stage/stage_verify.py]
    • Chosen: Gate on open types only. Matches open_findings, which keeps only findings of open types, and it saves more reviews.
    • Rejected: Gate on all 9 types. It runs the reviewer for defects that do not block the plan, so it saves less.
  • How does the Score question for plan quality affect the result?: The score is logged for the comparison only. It never gates, so Jev never approves a plan alone. (best practice) [sources: src/devops_cli/ai/jev.py]
    • Chosen: Log only. Keeps the rule of the issue body that Jev never approves and never rejects.
    • Rejected: Gate on the score. It adds a second gate whose score has no calibrated probability and no data to set it.
  • What value does the low threshold take, and where does it live?: Add one new constant in src/devops_cli/config/constants.py next to the CONST_AI_JEV_* constants, with a low provisional value of 0.05. The deferred comparison issue tunes it on the golden set. The switch stays off until a person reads that comparison. Do not reuse CONST_AI_JEV_DEFAULT_BOOLEAN_THRESHOLD (0.50): it is a yes/no cut, not a low screen threshold. (best practice) [sources: src/devops_cli/config/constants.py]
    • Chosen: New constant with a low provisional value. Follows the pattern of the CONST_AI_JEV_* constants. No live Jev route exists now, so the tuning waits for the comparison.
    • Rejected: Reuse CONST_AI_JEV_DEFAULT_BOOLEAN_THRESHOLD. At 0.50 it is a boolean cut, not low enough for a screen that must not miss defects.
  • Which Jev outcomes count as a failure that runs the reviewer?: An exception from _run_decide, a timeout, a missing answer for an open-type question, or a probability that is not a number all run the reviewer. _run_decide uses asyncio.run and does not catch errors, so the screen catches them, logs the error and returns 'run the reviewer'. (best practice) [sources: src/devops_cli/ai/jev.py]
    • Chosen: Fail open on every anomaly. The issue body requires that any Jev error, timeout or low confidence runs the reviewer.
    • Rejected: Fail closed. It would skip reviews when Jev is down and lose recall.
  • Can Jev be reached today?: No. A premise check on 2026-11-09 found that POST /v1/systemone answered HTTP 404, and that chat/completions refuses the decisions model. The route problem is issue fix(ai): the gateway has no route for the Jev Decisions API #4289. This item builds the screen with a fake Jev and keeps the switch off. The comparison on live Jev moves to a new issue. [sources: src/devops_cli/ai/jev.py]
  • Can the golden set show the false-positive rate of the screen?: No. It holds only 5 good plans in 56 directories. The later comparison reports recall and serious recall, and it states this limit. [sources: src/devops_cli/roadmap/stage/stage_verify_eval.py]
  • Who turns the switch on?: A person turns roadmap.stage.jev_screen on, after reading the offline comparison. This change keeps the default false. Recommendation: turn it on only if the cascade loses no serious recall on the golden set. (a person decides)

Open questions

  • Who turns the switch on? (a person decides)

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

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: P2-Medium. It is a cost-saving optimization behind a flag, not a defect fix or a blocking gap.
    • Value: Medium. It saves one agent run per skipped plan but the per-plan saving is small and the set cannot show the false-positive rate.
    • Effort: Low. The body scopes it to one function, one setting, two call sites and tests.
    • Related: feat(roadmap): the stage job verifies its plan with a model after the gates #3153, which asks for a different change. Both work on the stage verify step, but #3153 adds the model reviewer and the candidate adds a cheaper Jev screen that runs before it.
  3. added
    priority/p2-medium
    owner/agent
    on Nov 9, 2026
  4. devops-cli-service commented on Nov 9, 2026

    @devops-cli-service
    Contributor

    Refine cannot set this item to Ready at 84117ac until a person answers the questions below. Reply in a comment or edit the body, and the next refine round looks at the item again.

    • Who turns the switch on? (a person decides)
  5. 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.

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

    @devops-cli-service
    Contributor

    Refine cannot set this item to Ready at c70d673 until a person answers the questions below. Reply in a comment or edit the body, and the next refine round looks at the item again.

    • Who turns the switch on? (a person decides)
  7. added
    status/in-progress
    and removed
    status/new
    on Nov 10, 2026
  8. dan-petty commented on Nov 10, 2026

    @dan-petty
    OwnerAuthor

    Pilot 1 of the decision steps (ADR 0019, #4326) is in the draft pull request #4343. It replaces the design of this issue:

    • The screen is a digest of the plan that code builds (criteria, groups, and the facts of tools), with nine yes/no questions in one Jev request. The cuts are fitted data, not constants. The setting roadmap.stage.jev_screen has three values (off, shadow, on) and is off by default. The premise of the issue about the gateway route (fix(ai): the gateway has no route for the Jev Decisions API #4289) is solved: POST /v1/systemone answers.
    • Result: the bar is not met. The reviewer alone (DeepSeek) found no serious defect in 9 of the 48 reviewable cases (19%), so no screen can skip 30% of the reviews with no loss. The best design skipped 4% to 8% with no loss in 3 of 4 held-out directions. The setting stays off. The numbers, the attempts table and the spend are in the first comment of feat(roadmap): a Jev screen before the verify step #4343.
    • Answer to the open question "who turns the switch on": a person, after the shadow log of the live Service shows the false-clear rate of real reviews (counter devops_cli_roadmap_decision_step_review_total). The offline numbers do not justify on.
  9. added
    status/in-review
    and removed
    status/in-progress
    on Nov 10, 2026
  10. removed
    status/in-review
    owner/agent
    on Nov 10, 2026
  11. devops-cli-service commented on Nov 10, 2026

    @devops-cli-service
    Contributor
  12. devops-cli-service commented on Nov 10, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-10 07:20 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/p2-mediumscope/roadmapsource/agenttype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions