Skip to content

feat(ai): each Jev decision writes a job result line #5171

Description

@dan-petty

Part of #5164 (child 6).

Problem or Motivation

TypeSafe Jev answers the decision points of the roadmap jobs (ADR 0019, ADR 0020) and devops ai ask-jev. A Jev error, a timeout or a reply that does not parse makes the step fail open to the existing path (roadmap/decision_step.py). The counter devops_cli_roadmap_decision_step_total has the labels band, mode and step, and no label for a failed request. So no measure gives the share of Jev requests that end with a decision, and Jev gets no grade (#5164).

Proposed Solution & Architectural Design

  • Add the job jev to the result line.
  • Attempt: one decision request of a decision point or of ask-jev.
  • Results: decided, failed_open (error, timeout or a reply that does not parse). Intended result: decided.
  • First pass: decided on the first request (retries = 0).
  • Names: point (the decision point or ask-jev), answer (the band or the option, never text). Counts: retries, and the attempt counts of the result line.
  • item is the item of the decision point, or none.
  • The agreement of Jev with labelled cases stays in devops roadmap eval jev and the shadow report. The grade report shows the last score next to the grade.

Target Subsystem

AI & Agentic Review Pipeline (src/devops_cli/ai/jev.py, src/devops_cli/ai/jev_ask.py, src/devops_cli/roadmap/decision_step.py).

Existing Tool Considered

The decision step counter exists and does not count failures. The line uses the writer of the roadmap jobs; no new tool. Cost: about 150,000 tokens, 4 hours elapsed.

Acceptance Criteria

  • A decision with a fake Jev writes one line with result=decided first_pass=true.
  • A timeout writes result=failed_open with the class timeout.
  • No line holds the text of a question or an answer.

Dependencies

#5168, #5169.

Alternatives check of 2026-11-28: none.
Tool: none found.
Reason: Searches found only generic structured-logging and LLM-observability platforms (structlog, Langfuse), which do not write the project's roadmap job result: line, derive first-pass from its tables, or feed the Loki grade report; the change extends the existing log_job_result writer.

Lacks:

  • No writer of the project's roadmap job result: line format
  • No first_pass derivation from the SUCCESS_RESULTS and FIRST_PASS tables
  • No feed into the Loki query or devops roadmap eval grades row
  • A hosted or self-hosted service added for one counter

Proposed design

Problem statement

TypeSafe Jev answers the decision points of the roadmap jobs and devops ai ask-jev. A Jev error, a timeout or a reply that does not parse fails open to the existing path. No result line records the attempt, so the Jev job gets no grade. This change writes one jev job result line for each request. Then devops roadmap eval grades gives the Jev job a grade.

Acceptance criteria

Requirement: Jev result line for a decision point

A decision point SHALL write one jev job result line for each Jev request, with result=decided or result=failed_open, and with the class, first_pass, point, item, answer and retries fields.

Scenario: A decided request writes one line

  • WHEN A fake Jev model returns a valid answer for point stage.verify_screen on item 5171, and the test calls ResolverChain.decide.
  • THEN Exactly one captured line has job=jev, result=decided, success=true, first_pass=true, class=none, point=stage.verify_screen, item=#5171, answer equal to the band of the cuts, and retries=0.

Requirement: A timeout is failed_open

A Jev request that times out SHALL write result=failed_open with class=timeout, answer=none and first_pass=false, and SHALL leave the decision to the fallback.

Scenario: A timeout writes one failed_open line

  • WHEN A fake Jev model raises TimeoutError for point stage.verify_screen on item 5171, and the test calls ResolverChain.decide.
  • THEN The captured line has job=jev, result=failed_open, class=timeout, answer=none, success=false and first_pass=false, and the returned record has resolver=fallback.

Requirement: A model error uses provider

A Jev request that raises ModelAPIError SHALL write result=failed_open with class=provider and infra=true.

Scenario: A model error writes provider

  • WHEN A fake Jev model raises ModelAPIError, and the test calls ResolverChain.decide.
  • THEN The captured line has result=failed_open, class=provider and infra=true.

Requirement: An unparseable reply uses parser

A reply that gives no band SHALL write result=failed_open with class=parser.

Scenario: A missing answer writes parser

  • WHEN A fake Jev model returns a response with no answer for a question of the cuts, and the test calls ResolverChain.decide.
  • THEN The captured line has result=failed_open and class=parser.

Requirement: Ask-jev result line

ask_jev SHALL write one jev result line for each request with point=ask-jev, item=none, repo=none, and the chosen option or score as answer.

Scenario: An ask-jev choice writes one line

  • WHEN A fake Jev model returns option review to ask_jev with a choice question, and the test calls ask_jev.
  • THEN One captured line has job=jev, point=ask-jev, item=none, repo=none, result=decided, first_pass=true and answer=review.

Requirement: No question or answer text

A jev result line MUST NOT contain the text of a question, an option description or a free-form answer.

Scenario: Question text is absent from the line

  • WHEN A test calls ask_jev with the question text private question text, and a fake Jev model returns a valid option, and the test captures the result line.
  • THEN The captured line does not contain private question text, and its answer field is the option label only.

Requirement: The grade report lists the Jev job

devops roadmap eval grades SHALL list one row for the jev job with the grade of its result lines.

Scenario: The report has a Jev row

  • WHEN A test renders the grade report from a fake Loki answer with one jev result line.
  • THEN The report has a jev row with the grade too few.

Existing Tool Considered

The alternatives check of 2026-11-19 in the issue body returned none, with no tool; its block lists the tools that it considered and what each one lacks. No open, maintained tool writes the project's roadmap job result: line, derives first-pass from its tables, or feeds the Loki grade report. The change extends the project writer log_job_result in src/devops_cli/roadmap/job_result.py, which the Loki query and devops roadmap eval grades already read. The change adds RoadmapJob.JEV with its SUCCESS_RESULTS, FIRST_PASS and FIRST_PASS_LIMITS rows and the call sites, so the line reaches the existing grade report and keeps answer in a closed set. Written cost: about 150,000 tokens and 4 hours elapsed.

Key questions

  • Which writer emits the jev result line?: The shared writer log_job_result of src/devops_cli/roadmap/job_result.py. The change adds RoadmapJob.JEV with its SUCCESS_RESULTS, FIRST_PASS and FIRST_PASS_LIMITS rows. No new logger. (best practice) [sources: src/devops_cli/roadmap/job_result.py, src/devops_cli/roadmap/job_result.py:269, CONTEXT.md]
    • Chosen: Existing roadmap result-line writer. CONTEXT.md requires one result line for each roadmap step through the shared writer. The Loki query and the grade report already parse that format.
    • Rejected: New Jev-only logger. It duplicates the result-line format. The grade report would not read its lines.
  • Which values name the result and the failure class?: result is decided or failed_open. class is a FailureClass of src/devops_cli/roadmap/failure.py: timeout for a timeout, provider for a model error, parser for a reply that gives no band, and ci_infra for any other error. (best practice) [sources: src/devops_cli/roadmap/failure.py:67, docs/roadmap/job-success.md, src/devops_cli/roadmap/decision_step.py:75]
    • Chosen: Result-line taxonomy of roadmap/failure.py. docs/roadmap/job-success.md defines the line's class as a class of roadmap/failure.py.
    • Rejected: The decision-step FailureClass. Its model_error, secret and no_cuts values are labels of the decision-point counter. The grade report reads class from the result line.
  • Where does the code write the line?: In ResolverChain._resolve and _aresolve, around the one decide_all or adecide_all request, and in ask_jev, around decide_with_jev. Not in decide_all, which also serves the eval batch and does not know the band. (best practice) [sources: src/devops_cli/roadmap/decision_point.py:358, src/devops_cli/roadmap/decision_point.py:374, src/devops_cli/ai/jev_ask.py]
    • Chosen: ResolverChain and ask_jev. The chain computes the band in _banded and the failure class in _failed. ask_jev returns the typed option.
    • Rejected: Inside decide_all or adecide_all. decide_all has no cuts and no band. The screen eval calls it with a batch that must not count as job attempts.
  • What does item hold for ask-jev?: none. log_job_result writes item=none for a None item, and ask-jev has no roadmap item. The line also writes repo=none, because the command has no repository in scope. [sources: src/devops_cli/roadmap/job_result.py]
  • How does the line avoid question and answer text?: answer is the Band value for a decision point and JevAnswer.answer for ask-jev. The line never writes DecisionRequest.state, the question instructions or a free-form reply. log_job_result also replaces a value outside [A-Za-z0-9_.-] with other. (best practice) [sources: src/devops_cli/roadmap/decision_step.py:54, src/devops_cli/ai/jev_ask_models.py:23, src/devops_cli/roadmap/job_result.py]
    • Chosen: Band or typed option label. Both values come from closed sets and carry no free text.
    • Rejected: Raw model response. It can hold the question or a free-form answer.
  • Does the decision-step counter need a change?: No. The counter that the issue names, devops_cli_roadmap_decision_step_total, was replaced by devops_cli_decision_point_total, and devops_cli_decision_point_failed_total already counts a failed request by class. The result line is the new measure, because it gives the attempt first_pass and infra for the grade. [sources: docs/TELEMETRY.md, 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]
  • How does first_pass become true for a decided request?: Add RoadmapJob.JEV to SUCCESS_RESULTS with decided, and to FIRST_PASS and FIRST_PASS_LIMITS with CountLimit("retries", 0). The line writes counts={"retries": 0}, so a decided first request has first_pass=true. (best practice) [sources: src/devops_cli/roadmap/job_result.py:123, src/devops_cli/roadmap/job_result.py:155, src/devops_cli/roadmap/job_grade_report.py]
    • Chosen: Add the count rule to both first-pass tables. The line derives first_pass from FIRST_PASS. The report recomputes it from FIRST_PASS_LIMITS.
    • Rejected: Write first_pass only as a literal field. The field is derived from the tables. A literal would not change the report's first-pass count.
  • Which repository does the line name?: none. A decision point and ask-jev have no repository in scope, and log_job_result writes repo=none for an empty repo. (best practice) [sources: src/devops_cli/roadmap/job_result.py]
    • Chosen: Write repo=none. The chain and ask_jev hold no repository. The writer already defines the value for that case.
    • Rejected: Add a repo argument to every caller. No source names a repository for a decision point or ask-jev. It would change every caller for no measured gain.
  • Does the grade report show the last Jev score in this change?: No. devops roadmap eval jev prints a comparison and stores no score. The shadow report gives per-field ratios and no single number. This change gives the jev row its grade from the new result lines. The last score is a separate issue, filed as a deferred part. (best practice) [sources: src/devops_cli/roadmap/jev_eval.py, src/devops_cli/roadmap/jev_shadow_report.py, src/devops_cli/roadmap/job_grade_report.py]
    • Chosen: Defer the last score. No stored Jev score exists, so the report has no value to show.
    • Rejected: Define a score in this change. It needs a stored record and a rule for the number. That is a separate change.
  • Does ask_jev return a typed answer with a closed option or score?: Yes. _typed_answer returns a JevAnswer whose answer is the choice label, yes or no, or the score string. [sources: src/devops_cli/ai/jev_ask_models.py:23, src/devops_cli/ai/jev_ask.py]
  • Does decision_step.py already classify a failed request?: Yes. failure_class maps each error to decision_step.FailureClass for the decision-point counter. The result line uses the roadmap/failure.py taxonomy instead, as the result-line contract requires. [sources: src/devops_cli/roadmap/decision_step.py:75, docs/roadmap/job-success.md]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#5168, #5169

Moved to new items

#6397

Activity

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

    @dan-petty
    OwnerAuthor
  3. added
    priority/p2-medium
    on Nov 12, 2026
  4. devops-cli-service commented on Nov 17, 2026

    @devops-cli-service
    Contributor

    Waiting for the alternatives check to run. The next refine round looks at the item again after the check records a verdict.

  5. devops-cli-service commented on Nov 19, 2026

    @devops-cli-service
    Contributor

    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 (5)

    Tools considered:

    Searches run:

    • open source library record each LLM request outcome decision logging self-hosted, results: 5
    • python structured logging library write job result lines first pass success rate, results: 5
    • Langfuse LLM observability log each generation outcome score, results: 5
    • structlog python structured logging, results: 5
    • langfuse open source LLM observability github, results: 5

    Sources:

  6. added
    status/ready
    and removed
    status/new
    on Nov 19, 2026
  7. devops-cli-service commented on Nov 19, 2026

    @devops-cli-service
    Contributor

    Next step: the stage job writes the plan of the item. See Moved to new items in the section Proposed design of the body.

  8. added
    owner/agent
    status/in-progress
    status/in-review
    and removed
    status/ready
    status/in-progress
    on Nov 28, 2026
  9. removed
    status/in-review
    owner/agent
    on Nov 29, 2026
  10. devops-cli-service commented on Nov 29, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-29 03:13 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/mediumpriority/p2-mediumscope/aisource/agenttype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions