Skip to content

feat(roadmap): eval stage compares planner input with guide text #5501

Open

Description

@dan-petty

Problem or Motivation

The owner asked for a scaffold with a guide comment in each file. render_change (stage_change.py) writes every file of the change folder from the structured StageProposal, so a comment in a scaffolded plan file never gets to the planner. E1 of the approved pipeline split design (tracker #5482) tests the guide text where the planner reads it: as input text.

Proposed Solution & Architectural Design

  • Add --arm A|B to devops roadmap eval stage. Arm A is the planner input of today. Arm B adds the scaffold skeleton as input text, with one guide comment for each file:
    • proposal.md: the required sections, the ADRs and standards for the scope labels, and the criteria form.
    • tasks.md: the group form (n.1 failing test, n.2 code).
    • design.md: the rule-3 cost line.
    • The spec delta: the requirement and scenario form.
  • The guide text comes from the docs. Its writer does not read the cases.
  • Cases: the 51 golden cases that have a commit. The 8 NO_COMMIT cases stay out.
  • Primary measure (deterministic, written before the run): the share of first replies that pass the gates (paths, criteria, content, prompt_keys) and the Plan Check rows of feat(roadmap): run the plan checks before the stage push #4725, on the gated defect types. One run is one planner call.
  • Stratum: 36 cases hold a false_premise defect, which has the gate none. A reviewer judges them as a second stratum.
  • Secondary measures: the plan review verdict, the gate returns, and the tokens for each pass.
  • A/A first: run arm A two times on 10 cases. Report the discordance and the tokens of one run. The owner approves the budget from those tokens (D9).
  • Power (exact McNemar, n = 51, 80 %): the smallest lift that can show is 21 points at 30 % discordance and 28 points at 52 %. E1 is a screen for a large effect only.
  • Decision rule: adopt B when the McNemar p is below 0.05, the lift is 15 points or more, and the tokens for each pass rise by less than 20 %. Otherwise keep A.
  • Run outside the live agent semaphore with its own budget, 1 to 3 repeats. Use the majority result of each case, with a cluster bootstrap over the repeats as a check.
  • If B is adopted, the live arm uses the trial mechanism of feat(roadmap): trial a model tier on a share of a job's attempts #5177 (trial=<name> on the result line), extended to an arm that is not a model. The online guard uses the first attempt of each item. Stop B when its Wilson upper bound is below the point estimate of A, or when a one-sided Fisher test gives p below 0.1.

Target Subsystem

Roadmap Service and roadmap jobs (src/devops_cli/roadmap/stage/, the eval commands).

Acceptance Criteria

  • Test first: with a fake model, arm B puts the guide text in the planner input and arm A does not. The test fails on the base.
  • A test: the analysis gives the exact McNemar p and the lift on fixed pairs.
  • A comment on this issue gives the A/A result (discordance and tokens of one run) before any A/B run.
  • A comment on this issue gives the A/B result and the decision (adopt B or keep A).
  • If B is adopted: live proof: after the release, the stage Job runs arm B as the App through a feat(roadmap): trial a model tier on a share of a job's attempts #5177 trial, and its result lines carry the trial name. A comment gives the guard values at each check.

Existing Tool Considered

pydantic-evals 2.59.0, statsmodels 0.15.0 and scipy (locked) give the runs, the exact McNemar test, the power, the Wilson intervals and the Fisher test. devops roadmap eval stage holds the golden set. #5177 gives the live trial. Build: 150,000 to 300,000 agent tokens and 0.5 day. Model spend: from the A/A pass, approved by the owner.

Related

Tracker #5482, Phase 1, in parallel. Depends on #5411 for the review verdict measure. The live arm waits for #5177. #5512 uses the same harness. #5519 asks the same question on the delivery path.

Source: #5482

Alternatives check of 2026-12-01: in-use.
The repository already uses this tool.
Tool: pydantic-evals (https://github.com/pydantic/pydantic-ai), MIT, last activity 2026-12-01, maintained.
Reason: Searches and the issue body name pydantic-evals as the eval harness in use. It runs and scores cases, but adds no arm switch, guide-text injection or paired McNemar test, so it covers only part of the need.

Covers:

  • Runs a dataset of cases through a model
  • Evaluators score each output and record results
  • Stores per-case result rows for a report

Lacks:

  • No arm switch to vary the planner input
  • No guide-text injection into the planner prompt
  • No paired exact McNemar test or lift

Proposed design

Problem statement

The stage eval cannot compare two planner inputs today. A guide comment in a scaffolded plan file never reaches the planner because render_change writes each file from the structured StageProposal. This change adds --arm A|B, injects guide text into arm B, records the arm on each result row, and adds the exact McNemar p and the lift. The A/A run, the A/B run and the live #5177 trial wait on model spend and a release, so they become separate issues.

Acceptance criteria

Requirement: Arm flag defaults to A

The eval stage command SHALL accept --arm A|B and MUST use arm A when no arm is given.

Scenario: No arm flag

  • WHEN A test runs devops roadmap eval stage on one golden case with no --arm flag and with a fake model that records the planner prompt text.
  • THEN The recorded prompt text holds no guide text and the result row names arm A.

Requirement: Arm B adds guide text

Arm B SHALL add the guide text for proposal.md, tasks.md, design.md and the spec delta to the planner prompt text.

Scenario: Arm B with a fake model

  • WHEN A test runs devops roadmap eval stage --arm B on one golden case with a fake model that records the planner prompt text.
  • THEN The prompt text holds the guide text of proposal.md, tasks.md, design.md and the spec delta.

Requirement: Guide text from one docs file

The eval run SHALL read the guide text from one docs file, and the guide text MUST NOT depend on the golden case.

Scenario: Two cases share the guide text

  • WHEN A test points the guide loader at a temporary docs file with new text and runs arm B on two different golden cases with a fake model.
  • THEN The prompt text of both cases holds the new text and no text of the default guide file.

Requirement: Arm on each result row

Each result row of the eval record SHALL name the arm of its run, and a stored row with no arm MUST read as arm A.

Scenario: Two arms in one report

  • WHEN A test stores one arm A row and one arm B row in one report.
  • THEN Each row names its arm and a stored row with no arm reads as arm A.

Requirement: First reply passes every gate

The analysis SHALL count a case as a pass only when its first reply passes every gate and the Plan Check rows.

Scenario: First reply with a gate problem

  • WHEN A test gives a stored result row whose first reply has one gate problem.
  • THEN The analysis counts the case as a fail.

Requirement: First reply fails a Plan Check row

The analysis SHALL count a case as a fail when its first reply has a failing Plan Check row.

Scenario: First reply with a Plan Check problem

  • WHEN A test gives a stored result row whose first reply has one failing Plan Check row and no gate problem.
  • THEN The analysis counts the case as a fail.

Requirement: Exact McNemar p and lift

The paired analysis SHALL give the two-sided exact McNemar p and the lift in percentage points on the rows of two arms.

Scenario: Fixed discordant pairs

  • WHEN A test gives 51 pairs, with 12 that pass in arm B only and 4 that pass in arm A only.
  • THEN The analysis gives a p of 0.0768 to four decimal places and a lift of 15.7 points.

Requirement: Scaffold output unchanged

Arm B SHALL NOT change the files that render_change writes for the same reply.

Scenario: Same change folder in both arms

  • WHEN A test runs arm A and arm B on one golden case with the same fake reply.
  • THEN The change folder of both runs holds the same files and the same text.

Existing Tool Considered

The alternatives check in the issue body records pydantic-evals as in-use (https://pypi.org/project/pydantic-evals), and the repository already uses the tool. The check gives what the tool covers and lacks. This proposal adds the arm switch, guide-text injection, arm field on each result row, and exact McNemar p with lift. scipy binomtest gives the exact p. The project-specific code costs 150,000 to 300,000 agent tokens and 0.5 day to build, keep and fix. Model spend waits on the owner's approval from the A/A pass.

Key questions

  • Where does the eval run add the guide text to the planner request?: A guide client in stage_eval_run.py appends the arm B guide text to the prompt. Arm A passes the prompt unchanged. render_change stays unchanged. (best practice) [sources: src/devops_cli/roadmap/stage/stage_eval_run.py:92, src/devops_cli/roadmap/stage/stage_change.py]
    • Chosen: Guide client in stage_eval_run.py. It keeps the live planner and render_change unchanged. The eval run owns the arm.
    • Rejected: Parameter on plan_item. It changes the live planner signature for an eval-only switch.
    • Rejected: Change in render_change. render_change writes the files. A guide comment there never reaches the planner prompt.
  • Where does the guide text live, and how does the run read it?: The guide text lives in docs/roadmap/stage-guide.md. It has one section for proposal.md, tasks.md, design.md and the spec delta. A loader reads the file at run time and takes a path with the default. The text stays independent of the golden set. (best practice) [sources: docs/ROADMAP_WORKFLOW.md, CONTEXT.md]
    • Chosen: Docs file read at run time. The issue says the guide text comes from the docs. A docs file keeps the text reviewable and out of the code.
    • Rejected: Constant in stage_eval_run.py. The text mixes with the code. No docs review sees it.
    • Rejected: Change to the live planner prompt. The live prompt holds the live job rules. The change would move the live planner, not only the eval arm.
  • Which cases does the core change use, and which cases stay out?: The core change uses the existing golden set. The loader already leaves out a case with NO_COMMIT and names it. The change adds no case selection. [sources: src/devops_cli/roadmap/stage/stage_eval_cases.py:82, src/devops_cli/roadmap/stage/stage_eval_run.py, tests/roadmap/stage/test_roadmap_stage_eval_cases.py]
  • How does the analysis get the pass or fail of each first reply?: It reuses run_gates from stage_eval_gates.py and the Plan Check rows from plan_check.py. It reads the gate result that run_case keeps for the first reply. It builds no second scorer. (best practice) [sources: src/devops_cli/roadmap/stage/stage_eval_gates.py, src/devops_cli/roadmap/plan_check.py, src/devops_cli/roadmap/stage/stage_eval_record.py]
    • Chosen: Reuse the gates and Plan Check. The gates and Plan Check already define a pass. The measure matches the live job. No second scorer drifts.
    • Rejected: New scorer for the arms. It duplicates the gates and Plan Check. The two definitions drift.
  • Which locked code gives the exact McNemar p and the lift?: scipy binomtest gives the two-sided exact McNemar p on the discordant pairs. The lift is the difference in pass counts divided by the number of pairs. scipy is locked in uv.lock. (best practice) [sources: uv.lock]
    • Chosen: scipy binomtest. It gives the exact p from the lock. The lift is simple arithmetic on the pairs.
    • Rejected: statsmodels mcnemar with exact=True. It gives the same exact p. It adds a second path to the same value.
    • Rejected: Hand-written exact McNemar test. It duplicates binomtest. It adds code to build, keep and check.
  • How does the report pair the rows of the two arms?: Each result row gets an arm field with the default A. A stored row with no arm reads as arm A. The analysis joins the rows of one case across two stored reports and keeps one pair for each case. (best practice) [sources: src/devops_cli/roadmap/stage/stage_eval_record.py, tests/roadmap/stage/test_roadmap_stage_eval_record.py]
    • Chosen: Arm field on each result row, default A. The analysis joins rows by case. An old report keeps a meaning.
    • Rejected: Arm in the report file name. The analysis must match two files by hand. An old file carries no arm.
    • Rejected: Arm in the case name. Other code matches a case by its name. A changed name breaks the match.
  • Should the arm comparison reuse the compare form of the eval command?: No. stage_eval_compare.py compares two toolsets in one invocation. The arm comparison reads two stored reports and adds a paired exact test. The arm stays a flag on devops roadmap eval stage. (best practice) [sources: src/devops_cli/roadmap/stage/stage_eval_compare.py, src/devops_cli/roadmap/stage/stage_commands.py, tests/roadmap/stage/test_roadmap_stage_eval_compare.py, tests/roadmap/stage/test_roadmap_stage_eval_command.py]
    • Chosen: Flag on eval stage with paired test beside compare deltas. The arm needs its own run and repeats. Its rows come from two stored reports, not one invocation.
    • Rejected: Extend the compare form to vary the arm. The compare form varies the toolset in one invocation. It holds no repeats and no paired test.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Moved to new items

#8018, #8019, #8020

Activity

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

    @dan-petty
    OwnerAuthor
  4. added
    priority/p2-medium
    on Nov 13, 2026
  5. devops-cli-service commented on Nov 18, 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.

  6. devops-cli-service commented on Nov 20, 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 (10)

    Tools considered:

    Searches run:

    • open source LLM eval tool compare two prompts A/B statistical significance McNemar, results: 5
    • promptfoo compare prompt variants statistical significance eval, results: 5
    • "McNemar" LLM evaluation tool open source paired comparison, results: 5
    • promptfoo eval compare two prompts side by side test cases docs, results: 5
    • pydantic-evals documentation evaluator dataset report, results: 5
    • promptfoo, results: 5
    • pydantic evals experiments compare evaluators, results: 5
    • pydantic_evals python package eval framework, results: 5
    • inspect_ai evaluation framework scorers dataset, results: 5
    • "pydantic-evals", results: 5

    Sources:

  7. dan-petty commented on Nov 20, 2026

    @dan-petty
    OwnerAuthor

    Frozen on 2026-11-20. The stage, implement and fix-checks jobs grade under 60%, so the owner rule asks for a re-architecture before more fixes inside the current design (tracker #6519). This item is incremental work on those jobs, so its Dependencies section now names #6521 first. Stage and implement leave this item while #6521 is open. When the experiments of #6519 decide, a person closes #6521 (this item can then continue) or closes this item as not planned.

  8. devops-cli-service commented on Nov 21, 2026

    @devops-cli-service
    Contributor

    Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies and Watched files in the section Proposed design of the body.

  9. devops-cli-service commented on Nov 23, 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.

  10. added
    status/ready
    and removed
    status/new
    on Dec 1, 2026
  11. devops-cli-service commented on Dec 1, 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.

  12. devops-cli-service commented on Dec 1, 2026

    @devops-cli-service
    Contributor

    The result in the alternatives block of the issue body changed. Before this check: in-use, tool https://pypi.org/project/pydantic-evals. A person decides what the new result means for the item.

    Searches (5)

    Tools considered:

    Searches run:

    • scipy binomtest exact McNemar test paired comparison, results: 5
    • pydantic-evals evaluation framework compare two prompts, results: 5
    • pydantic-evals package documentation, results: 5
    • exact McNemar test python library, results: 5
    • pydantic-evals LLM evaluation dataset evaluator report, results: 5

    Sources:

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/highpriority/p2-mediumscope/roadmapsource/agentstatus/readytype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions