Repository navigation
Description
Split from #4831.
Problem or Motivation
Group analysis rejects most groups for quote grounding. A persona lens may not improve the accept rate, and a producer grounding section may. The work sets the baseline and the A/A set on the generic group-analysis prompt, each with k = 3, and reads a change against the floor between them. It runs arm G (a producer grounding section) and arm L (the lens section of #4830), each with k = 3. An arm becomes the default only when its G10 accept rate is above the floor for mypy and semgrep, no producer drops, and its prompt tokens for each accepted group rise by 10 % or less. Else the pull request deletes the section. The result goes into the section that #4831 adds to docs/SELF_IMPROVEMENT.md under Prompt Benchmarking.
Why deferred
The 12 runs need the model gateway and about 5 USD, and a person starts them, because the gate runs no model. The outcome decides which section is deleted, so no agent can write it in advance.
Dependencies
Acceptance Criteria
- The run store holds the 4 arm sets, each with k = 3.
docs/SELF_IMPROVEMENT.mdrecords the A/A floor, the G10 accept rate of mypy and semgrep for each arm, the prompt tokens for each accepted group, and the keep-or-delete decision.- The same pull request deletes the section of an arm that loses.
Proposed design
Problem statement
Build the arm scorer and decision harness now; defer the 12 model-gateway runs and the docs record to a person. Group analysis rejects most groups for quote grounding, and the project has no A/A floor or repeatable arm score to compare a producer grounding section and a lens section. The harness reads the existing review-benchmark runs, scores each producer, and applies the keep-or-delete rule. The live measurement needs the model gateway, about 5 USD, and a person's decision, so a new issue holds it.
Acceptance criteria
Requirement: Four arm definitions
The prompt benchmark SHALL define four arms, baseline, A/A, G and L, and each arm MUST run k = 3 reviews.
Scenario: Four arms with three runs
- WHEN the test
uv run devops ci test tests/ai/review/test_prompt_benchmark.py -k test_the_four_arms_each_run_three_timescalls the arm builder - THEN it returns four arms in the order baseline, A/A, G and L, and each arm's
runsis 3.
Requirement: Per-producer G10 accept rate
The arm score SHALL count, for each producer, the dispatched groups that hold its findings and have status verified, over all dispatched groups that hold its findings.
Scenario: One verified and one rejected group
- WHEN the test
uv run devops ci test tests/ai/review/test_prompt_benchmark.py -k test_the_accept_rate_counts_each_producer_of_a_groupscores a temporary session whose group-analysis records hold a verified mypy group and a rejected semgrep group - THEN the mypy rate is 1.0, the semgrep rate is 0.0, and the skipped group is left out.
Requirement: A/A floor
The arm score SHALL take the A/A floor for each producer as the [min, max] range of the A/A arm's G10 accept rates, and an arm MUST be above the range's upper bound to pass.
Scenario: An arm above the A/A range
- WHEN the test
uv run devops ci test tests/ai/review/test_prompt_benchmark.py -k test_the_floor_is_the_aa_rangegives the A/A arm mypy rates of 0.40, 0.50 and 0.60 and the candidate arm a mypy rate of 0.70 - THEN the mypy floor is
[0.40, 0.60]and the candidate arm passes the mypy gate.
Requirement: Keep rule
The arm decision SHALL keep an arm only when its G10 accept rate is above the A/A floor for mypy and semgrep, no producer's rate is below the floor's lower bound, and its prompt tokens per accepted group rise by 10% or less.
Scenario: Keep an arm that passes every gate
- WHEN the test
uv run devops ci test tests/ai/review/test_prompt_benchmark.py -k test_the_decision_keeps_an_arm_that_passes_every_gategives the decision metrics above the floor, no producer drop and a 5% token rise - THEN the decision returns
keep.
Requirement: Delete rule
The arm decision SHALL delete an arm when its G10 accept rate is at or below the A/A floor for mypy or semgrep, a producer's rate is below the floor's lower bound, or its prompt tokens per accepted group rise by more than 10%.
Scenario: Delete an arm that fails the mypy gate
- WHEN the test
uv run devops ci test tests/ai/review/test_prompt_benchmark.py -k test_the_decision_deletes_an_arm_that_fails_one_gategives the decision metrics with a mypy rate at the floor's upper bound - THEN the decision returns
deleteand names the mypy gate.
Requirement: Prompt tokens per accepted group
The arm score SHALL take prompt tokens per accepted group as the sum of the group_analysis stage's prompt tokens over the arm's sessions divided by the number of groups with status verified.
Scenario: Two sessions with three accepted groups
- WHEN the test
uv run devops ci test tests/ai/review/test_prompt_benchmark.py -k test_the_prompt_tokens_per_accepted_groupscores two sessions whose review profile records 300 and 600group_analysisprompt tokens and whose group-analysis records hold three verified groups - THEN the score is 300.0 prompt tokens per accepted group.
Requirement: Benchmark report
The benchmark report SHALL hold the A/A floor, the mypy and semgrep G10 accept rate of each arm, the prompt tokens per accepted group, and the keep-or-delete decision.
Scenario: Report holds each result column
- WHEN the test
uv run devops ci test tests/ai/review/test_prompt_benchmark.py -k test_the_report_holds_each_result_columnrenders a report from sample arm scores - THEN the report has a row for each arm and columns for the A/A floor, mypy rate, semgrep rate, prompt tokens per accepted group and decision.
Existing Tool Considered
No alternatives check has run. pydantic-evals is the closest open, maintained library: it ships with pydantic-ai, is locked in uv.lock, and is used by src/devops_cli/roadmap/duplicate_eval.py. It covers a dataset of cases, custom evals and a run report. It does not run a review, so it cannot produce the k reviews of one corpus or the session's group-analysis records; it also has no baseline/compare across runs and no per-producer accept-rate or token rule. The existing review benchmark, the run store and devops ai runs compare cover the arm runs and the comparison. The change adds only the G10 arm scorer and the keep/delete decision: about 5k tokens and 2 hours to build, about 1k tokens a year to keep, and about 2k tokens to fix. It deletes no code.
Key questions
- Where do the four arm sets and their runs live?: In the existing run store. Each arm is one
review-benchmarkrun from the review benchmark with--runs 3. ItsBenchmarkSummaryrecordsruns: 3and three session ids. All four arms use the same corpus digest and target, sodevops ai runs comparereads them. The change adds no second store. (best practice) [sources: src/devops_cli/ai/run_store.py, src/devops_cli/commands/review.py, src/devops_cli/ai/review/profile.py]- Chosen: Existing run store. It already records review-benchmark runs and supports compare.
- Rejected: A new arm store. It duplicates the run store and has no compare.
- Which rule selects the default arm?: Use the body rule. Keep an arm only when its G10 accept rate is above the A/A floor for mypy and semgrep, no producer's rate is below the floor's lower bound, and its prompt tokens per accepted group rise by 10% or less. The A/A floor is the A/A arm's range, so above it means above the upper bound. This rule adds the accept-rate and producer gates to the token check. (best practice) [sources: docs/SELF_IMPROVEMENT.md, src/devops_cli/ai/run_store.py]
- Chosen: G10 above the A/A floor with producer and token gates. It reads each arm against the A/A noise floor and prevents a producer or token regression.
- Rejected: Raw accept rate only. It can hide a producer drop and a token-cost regression.
- Rejected: A significance test. With k = 3 the project's prompt benchmarking section says no significance test is run.
- How many runs does each arm need?: k = 3.
DEFAULT_REVIEW_BENCHMARK_RUNSis 3, and the prompt benchmarking section says that with k = 3 no significance test is run. Four arms need 12 reviews. [sources: src/devops_cli/config/defaults.py, docs/SELF_IMPROVEMENT.md] - Which tool scores the arms and decides the default?: Reuse the existing review benchmark and run store for the arm runs, and the locked pydantic-evals for the eval layer. Add a small G10 arm scorer and the keep-or-delete decision. The review benchmark already runs k reviews and records a run. pydantic-evals is already the project's eval library. Inspect AI is not a dependency. (best practice) [sources: uv.lock, src/devops_cli/roadmap/duplicate_eval.py, src/devops_cli/ai/run_store.py]
- Chosen: Reuse the review benchmark, run store and pydantic-evals. They cover the k runs, the run record and the eval; only the G10 metric and the rule are missing.
- Rejected: Inspect AI. It is not a dependency, and it would add a second harness beside the run store; no source in the repository names it.
- Rejected: Build the whole benchmark and scorer. The run store, the review benchmark and pydantic-evals already cover the run and the eval, so that code would duplicate them.
- How is a producer's G10 accept rate counted when a group holds findings from more than one producer?: A group counts once for each producer that has at least one finding in it. The producer's rate is the dispatched groups that hold its findings and whose status is
verified, over the dispatched groups that hold its findings.GroupAnalysisRecordholdsfinding_idsandstatus, so the scorer joins the ids to the tools infindings.jsonand leavesskippedgroups out. (best practice) [sources: src/devops_cli/review/analysis.py]- Chosen: Per group, counted for each producer it holds. It uses the saved group record and covers mixed groups.
- Rejected: Per finding, accepted groups' findings over all findings. A large group would dominate a producer's rate.
- Rejected: Per group, only groups whose findings are all one producer. It drops mixed groups, so the rate covers fewer groups.
- How does an arm's prompt tokens per accepted group get measured?: From the
group_analysisstage's prompt tokens that the review profile records for each session. Sum them over the arm's sessions and divide by the number of groups with statusverified.GroupAnalysisRecordrecords no per-group token count, and the review profile already recordsprompt_tokensfor thegroup_analysisstage. (best practice) [sources: src/devops_cli/review/analysis.py, src/devops_cli/ai/review/profile.py]- Chosen: Stage prompt tokens over accepted groups. The profile already records the stage tokens and the analysis record gives the accepted groups.
- Rejected: Add a token count to each GroupAnalysisRecord. It changes the analysis schema and needs the model call's usage plumbed through the group job for a one-off measurement.
- Rejected: The benchmark's median prompt tokens only. It is not per accepted group.
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
devops-cli-service commentedon Nov 15, 2026
Both concern the grounding and lens arms in group analysis, but #4831 is the umbrella and the candidate is the deferred measurement and keep-or-delete decision.devops-cli-service commentedon Nov 18, 2026
Owner question: Who starts the 12 model runs and reads the outcome? (a person decides)
Options
Recommendation: Decide the question: only a person can answer it.
Evidence
devops-cli-service commentedon Nov 21, 2026
Next step: the alternatives check records a verdict. See the section Proposed design of the body.