Skip to content

feat(roadmap): an optional evaluation step finds attempt causes #5525

Open

Description

@dan-petty

Part of #5164.

Problem or Motivation

The result line of a roadmap job gives a failure class, such as plan_defect, tests_lost or types. The class names the symptom, not the cause. For example, stage failed 7 of 10 attempts in 24 hours on 2026-11-13, each with plan_defect. The line does not say why the plan review did not converge. Possible causes include an unclear issue body, missing context, a review finding outside the issue, or a planner that ignored a finding. Today an agent or a person reads the trace by hand to find the cause, one attempt at a time. The owner asked for an optional evaluation step at the end of each Service job to collect these insights about the job prompt and the execution environment (2026-11-13).

Proposed Solution & Architectural Design

Add an optional evaluation step that runs after the end write of a job attempt. It has two parts, and the deterministic part comes first.

  1. Run facts (no model). From the trace and the round log of the attempt, compute a short, fixed record:
    • the tool calls by name;
    • the repeated identical reads and searches;
    • the commands that the policy refused;
    • the tool errors;
    • the time and size of each phase;
    • the context size at the start;
    • the open review findings of each round.
  2. Decision-model questions. Ask the decision model (ai.decision_model, ADR 0020) a small, fixed set of closed questions for each job. Each question gets the run facts and short excerpts only, never the full trace. Each answer is one option or yes/no with a probability, so the answers add up across attempts. Examples:
    • Pick the main cause of the failure: unclear issue, missing context, refused tool or command, test or CI fault, task too large, model error.
    • Did the attempt look for information that every attempt of this job looks for? (This feeds the context study, fix(roadmap): search_code shows code lines first and skips the archive #5462.)
    • For stage: does each open review finding name a defect in the plan, or does it ask for work outside the issue?
    • For implement: did a refused command block the step, with no allowed alternative?

Rules:

  • The step only observes. It never changes the result, the record, the issue or the branch, and a failure of the step does not fail the job.
  • Setting roadmap.<job>.evaluate takes off, failures, sample or all, with roadmap.<job>.evaluate_sample as the sampled share of successes. Default off. Use failures plus a 10% sample of successes after calibration, so that each answer has a contrast set.
  • The answers go on the result line, or on one linked evaluation line, as fields. devops roadmap eval grades shows the share of each cause for each job.
  • Calibrate before use. Label 30 past failed attempts by hand (the shepherd triage notes hold most of them) and measure the agreement of each question. Remove a question whose answer adds no information beyond the failure class and the run facts (no decision point is on yet, and the verify screen showed no lift over its rule).

Target Subsystem

Roadmap Service jobs (src/devops_cli/roadmap/job_result.py, roadmap/round_log.py, the decision points of ai/, roadmap/job_grade_report.py).

Existing Tool Considered

  • Pydantic Evals (already in uv.lock) runs evaluators over a case set. It fits the calibration set, not the live step.
  • Logfire and Langfuse evaluations score traces. Logfire cloud is out by the telemetry privacy rule, and Langfuse adds a new service.
  • The decision-model path of ADR 0020 already exists with registered decision points, so the live step reuses it.

Cost: about 400,000 model tokens to build, 1 to 2 days elapsed. Run cost is a few decision-model calls on each failed attempt.

Acceptance Criteria

  • A test with a failed stage attempt and the setting failures finds one evaluation record with the run facts and one answer for each question. A test with off finds none (devops ci fail-to-pass).
  • A test where the decision model fails finds the job result unchanged and the evaluation recorded as unavailable.
  • devops roadmap eval grades shows the cause shares for each job with 5 or more evaluated attempts.
  • A calibration report on 30 hand-labelled attempts gives the agreement of each question. Questions under the band that ADR 0020 sets for a decision point are removed before the default changes from off.

Dependencies

Alternatives check of 2026-12-01: in-use.
The repository already uses this tool.
Tool: Pydantic Evals (https://pypi.org/project/pydantic-evals), MIT, last activity 2026-11-28, maintained.
Reason: Searches found no tool that computes run facts from the trace and round log and writes the linked evaluation line. Pydantic Evals covers only the labelled case set, so the live step stays project code.

Covers:

  • Evaluators over a labelled case set
  • Dataset report with one result for each case
  • Runs in the existing pydantic-ai stack, no new service

Lacks:

  • No live step after the end write of an attempt
  • No run-fact counts from trace and round log
  • No evaluation line or cause-share report

Proposed design

Problem statement

The result line of a roadmap job gives a failure class, such as plan_defect, but not the cause. An agent or a person reads the trace by hand for each attempt. This change adds an optional evaluation step after the end write. It computes fixed run facts from the trace and the round log, and it asks the decision model a few closed questions with probabilities. The step only observes and never changes the result. Calibration is a separate issue, and the default stays off.

Acceptance criteria

Requirement: Off mode writes no evaluation line

The setting roadmap.<job>.evaluate SHALL default to off and run no evaluation step.

Scenario: An off stage attempt writes no evaluation line

  • WHEN A stage attempt ends with failure class plan_defect and roadmap.stage.evaluate is off
  • THEN The captured log holds no line with the prefix roadmap job evaluation: and the result line holds the same fields as an attempt with no evaluation code

Requirement: Failures mode writes one record

With roadmap.stage.evaluate set to failures, a failed stage attempt SHALL write one evaluation record with the run facts and one answer for each registered question.

Scenario: A failed stage attempt is evaluated

  • WHEN A stage attempt ends with failure class plan_defect and roadmap.stage.evaluate is failures
  • THEN One line with the prefix roadmap job evaluation: holds job=stage, repo, item, attempt=1, the run-fact counts and one answer field for each registered question

Requirement: Run facts count the trace

The run-facts builder SHALL count the tool calls by name, the repeated identical reads and searches, the refused commands, the tool errors, the time and size of each phase, the context size at the start and the open findings of each round.

Scenario: A trace with a repeated read, a repeated search and a refused command

  • WHEN The builder reads a fixture trace with two identical reads, two identical searches, one command that the policy refused and one tool error
  • THEN The record holds repeat_reads=1, repeat_searches=1, refused_commands=1 and tool_errors=1, with one count for each tool name

Requirement: Sample mode keeps the decision stable

The sample mode SHALL evaluate a success when a stable hash of the attempt falls under roadmap.<job>.evaluate_sample, and it MUST give the same decision for the same attempt.

Scenario: The same attempt identity is sampled twice

  • WHEN roadmap.stage.evaluate is sample with roadmap.stage.evaluate_sample of 0.1, and 10000 attempt identities are sampled twice
  • THEN Each identity gives the same decision on both calls, and the count of evaluated identities is between 900 and 1100

Requirement: A model failure keeps the result

A failure of the evaluation step MUST leave the job result, the job record, the issue and the branch unchanged, and record the evaluation as unavailable.

Scenario: The decision model raises

  • WHEN The decision model raises for a failed stage attempt with roadmap.stage.evaluate of failures
  • THEN The attempt writes its result line with the same fields and the same exit code as with no evaluation, and the evaluation line holds outcome=unavailable

Requirement: Evaluation leaves the result unchanged

The evaluation step MUST run after the end write and leave the result line, the job record, the issue and the branch unchanged.

Scenario: A successful stage attempt with evaluation all

  • WHEN A stage attempt succeeds with roadmap.stage.evaluate of all
  • THEN The attempt writes the same result line fields and the same exit code as with off, and one evaluation line follows the result line

Requirement: Eval grades shows the cause shares

devops roadmap eval grades SHALL print the share of each cause for each job with 5 or more evaluated attempts.

Scenario: A job with five evaluated attempts and a job with four

  • WHEN devops roadmap eval grades reads a fixture with 5 evaluated stage attempts, 3 with cause unclear_issue and 2 with cause missing_context, and 4 evaluated implement attempts
  • THEN The output gives stage unclear_issue 0.6 and missing_context 0.4, and it gives no cause share for implement

Requirement: The evaluation line holds names only

The evaluation line SHALL hold only numbers and names of at most 64 characters, like the result line, and it SHALL carry job, repo, item and attempt so a query joins it to the result line.

Scenario: A cause name with a space

  • WHEN An evaluation record holds a cause name with a space and a question name of 80 characters
  • THEN The line writes other for each of the two fields and keeps the job, repo, item and attempt fields

Existing Tool Considered

The alternatives check in the issue body records the verdict in-use for pydantic-evals (https://pypi.org/project/pydantic-evals, MIT, maintained), because the repository already uses it. The check lists what the tool covers and lacks. This proposal uses pydantic-evals for the calibration set in the deferred calibration issue and builds the live step that the check says the tool lacks. Written cost to build and keep that code: about 400,000 model tokens and 1 to 2 days elapsed; each evaluated attempt costs a few decision-model calls.

Key questions

  • Where do the run facts of an attempt come from?: From the trace of the attempt and its round log. src/devops_cli/roadmap/round_log.py writes one round line for each review round and gate return, and src/devops_cli/roadmap/job_result.py names that logger in _LINE_LOGGERS. The builder reads these lines and the trace, and it asks the model for nothing. [sources: src/devops_cli/roadmap/round_log.py, src/devops_cli/roadmap/job_result.py]
  • Where does the evaluation record go?: On one separate line with the prefix roadmap job evaluation:. The line carries job, repo, item and attempt. The result line keeps its fixed fields. A query joins the two lines on those four fields. A failed step writes its own unavailable line. (best practice) [sources: src/devops_cli/roadmap/job_result.py]
    • Rejected: Fields on the result line. The result line has a fixed format that a Loki count_over_time query counts, and the answer set differs for each job. A variable field set breaks that count.
    • Chosen: One separate linked line. The result line stays fixed, a query joins the two lines on job, repo, item and attempt, and a failed step writes its own unavailable line.
  • Does the step add a decision point, or call the decision model directly?: It calls the decision model that ai.decision_model names, directly, with a fixed structured-output model. It registers no decision point. A decision point returns one band of continue, review or flag and never a text, so it cannot hold a probability for each option. (best practice) [sources: CONTEXT.md, tests/ai/models/test_pydantic_ai_ollama.py]
    • Rejected: Register a decision point of ADR 0020. A decision point returns one of three bands and no text, so it cannot carry a closed question with a probability for each option.
    • Chosen: Call the decision model with a fixed response model. The decision-model path already exists, and a structured response model gives one option and its probability for each fixed question.
  • Which settings control the step, and what are their defaults?: roadmap.<job>.evaluate takes off, failures, sample or all, and it defaults to off. roadmap.<job>.evaluate_sample gives the share of successes that sample evaluates, and it defaults to 0.1. sample decides by a stable hash of the job, the repository, the item and the attempt number, so the same attempt gets the same decision. The keys go in the roadmap section of src/devops_cli/config/settings.py, and their defaults go in src/devops_cli/config/defaults.py. (best practice) [sources: src/devops_cli/config/settings.py, src/devops_cli/config/defaults.py]
    • Rejected: One global roadmap.evaluate setting. Each job has a different trace shape and a different model cost, so one share for all jobs is too coarse.
    • Chosen: One pair of keys for each job. Each job sets its own mode and sample share, and a job that is not calibrated stays at off.
  • How does the command report the cause shares?: devops roadmap eval grades adds the cause shares to its existing report in src/devops_cli/roadmap/job_grade_report.py, for each job with 5 or more evaluated attempts. The report reads the evaluation lines with the result lines that it already reads. (best practice) [sources: src/devops_cli/roadmap/job_grade_report.py, CONTEXT.md]
    • Rejected: A new devops roadmap eval causes command. It adds a second command that reads the same lines and splits one report in two.
    • Chosen: Extend devops roadmap eval grades. The command already reads the attempt lines from Loki and prints the job grade, so the cause shares belong in the same report.
  • What does the step do when the model or the run-facts builder fails?: The step catches the error, writes one evaluation line with outcome=unavailable, and returns. The result line, the job record, the issue and the branch stay as they are, and the job exit code does not change. (best practice) [sources: src/devops_cli/roadmap/job_result.py]
    • Rejected: Fail the job. The step only observes, so a fault of the step must not turn a good attempt into a failed one.
    • Chosen: Record unavailable and keep the result. The attempt keeps its own outcome, and the report counts the missing answers instead of hiding them.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#5164

Activity

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

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

    @devops-cli-service
    Contributor

    Alternatives check: in-use

    Reason: Searches found no tool that runs an evaluation step on each live attempt; Pydantic Evals, already in the project's lock, covers only the hand-labelled calibration set and its per-question agreement report.

    The repository already uses this tool.

    Tool: pydantic-evals (https://pypi.org/project/pydantic-evals), MIT, last activity 2026-11-17, maintained.

    Covers:

    • Case set of 30 hand-labelled attempts with one evaluator per question
    • Runs the evaluators in a test or CI job
    • Reports agreement for each evaluator across the cases

    Lacks:

    • No step after the end write of a live attempt
    • No deterministic run facts from trace and round log
    • No evaluate setting, success sampling or eval grades report
    • No closed decision-model questions with probabilities
    Searches (6)

    Tools considered:

    Searches run:

    • open source LLM evaluation framework score agent traces self-hosted LLM-as-judge, results: 5
    • pydantic-evals evaluators dataset evaluate agent task, results: 5
    • Langfuse LLM evaluation traces self-hosted open source, results: 5
    • Opik Comet LLM evaluation open source traces, results: 5
    • pydantic-evals pypi, results: 5
    • LLM agent trace evaluation harness python library scores per attempt, results: 5

    Sources:

    A person decides what this check of 2026-11-17 means for the item.

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

    @devops-cli-service
    Contributor

    Refine cannot set this item to Ready at 86358b6 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.

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

    @devops-cli-service
    Contributor

    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.

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/roadmapsource/agentstatus/newtype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions