Repository navigation
Description
Context & Rationale
_evaluate_criteria_verdict (ai/review/review_environment.py:300-342) treats the two kinds of criteria differently:
- If the only passing verification commands are tautological (
git grep/grep,:292-297), the finding is capped at UNVERIFIED. - Any passing invalidation criterion, tautological or not, returns a final INVALIDATED with
by=criteria(:306-331). For example,_evaluate_criteria_verdict(['git grep -n os.system app.py'], [], [])returns('INVALIDATED', 'criteria', ...).
That verdict is final. Criteria run during deterministic pre-verification (verification.py:1276-1279), and only UNVERIFIED findings reach the model (:2039-2048). So a grep that merely finds the code a finding cites dismisses the finding.
The prompts contradict each other:
review_output_instruction.md:15andcompose.md:39(the recompose system prompt,runner.py:1168) show an executablegit grepverification criterion as the canonical example.review.md:56andverify_finding_system.md:38call grep criteria tautological.
No test checks the shipped prompt examples against the executor.
Scope & Deliverables
- Deliverable:
- A passing invalidation criterion whose command is tautological, under the same classifier used for verification, yields UNVERIFIED with a note instead of INVALIDATED.
- Replace both prompt examples with an allowlisted, non-tautological criterion: a
python -cassertion over the cited code. review.mdandreview_output_instruction.mdstate that grep-only criteria can neither verify nor invalidate.- A parametrised test extracts every executable criterion from the fenced JSON in
src/devops_cli/ai/tasks/*.mdandpersonas/*/prompt.md, and checks each one againstvalidate_criteria_commandand_is_tautological_verification_command.
- Acceptance criteria:
- A finding with only a passing grep invalidation criterion ends UNVERIFIED. A non-tautological passing invalidation criterion still gives INVALIDATED.
- Golden case: a finding whose only invalidation criterion greps its own cited line stays reportable.
- The prompt-example test fails on 308a71f and passes after the change.
- The new tests run offline in at most 1 s.
- Key questions:
- How does this overlap with refactor(review): one rulebook for known false positives #770 ('criteria rules are stated in three places')? (proposed) This item fixes the behaviour and the examples; refactor(review): one rulebook for known false positives #770 moves the rules into the rulebook.
- Constraint: Act on each verdict separately; never reject a whole reply.
Strategic Alignment
- Milestone: Backlog
- Depends on: none
Scope extended (2026-10-02, review session 20261001-224227)
Moved into v0.2.25 with the review-loop work the owner asked for. In that session the grep rule alone would not have helped: 36 findings were VERIFIED by criteria, and none of their 37 passing commands checks the cited code.
- 97% of passing
python -ccriteria (437 of 450) contain noassert,raiseorsys.exit. - The top CRITICAL finding cites CVE-2021-44228 and was VERIFIED by
python -c "import re; print(re.match(r'^[\w\W]*$','test content'))". - 59 of 61 criteria-INVALIDATED findings rest on the same kind of command.
tests/test_executable_criteria.py:225and:283requirex = 1; assert x == 1andassert 1 + 1 == 2to verify and to invalidate.
Added scope. The prompt half moves to #951, which owns the prompt text; this item owns the executor.
- Evidence rule, on both sides (
review_environment.py:292-342):- A passing command counts only if its AST imports the cited module, or opens the cited path, AND contains
assert,raiseorsys.exit(<non-constant>). pytestcounts only on a test that imports the cited code.grep,git grep,git log,wc,cat,head,tailandfindnever count.- A command that does not count is recorded in
criteria_execution_resultsand leaves the finding UNVERIFIED for the model. - When both a verification and an invalidation criterion pass, the pair is non-discriminating: UNVERIFIED with a note.
- A passing command counts only if its AST imports the cited module, or opens the cited path, AND contains
- Model-written verdict fields.
reset_verification_statealso clearsconfidence_score,citation_line,mitigating_mechanism,perimeter_files,regression_testandcriteria_execution_results.- A citation counts only from an explicit citation key, never from the echoed
location. - The verifier input (
_build_validation_prompt) no longer carries the reviewer'sconfidence_score,status,reportable,criteria_execution_results,verified_criteria_matchedorthinking. - Confidence is clamped to [0, 1] on every write; 3 findings carried 2.0.
- A refutation of the criteria is not a refutation of the code. An INVALIDATED verdict whose reason is about the criteria (
tautolog|criteri\w+ (only|merely)|only confirms) and that has no explicit citation becomes UNVERIFIED. There were 14 in the session. - Verifier coverage.
- New notes
verifier-no-verdictandverifier-reply-unparsed(verification.py:2071-2078), counted inprofile.json. In the session, 233 of 357 UNVERIFIED findings carried no note.
- New notes
- Verdict copy-back (
pipeline.py:2673, triage idx 203). OneVERDICT_FIELDStuple next toapply_verdictholds every field the verifier owns, and the copy-back uses it. - Test hermeticity (triage idx 84).
tests/test_finding_repetition_compression.py:62stops reading the local.datacache. - Tests:
- Invert
test_executable_criteria.py:225and:283. - A positive case: a temp
app.pypluspython -c "from app import f; assert f(...) == ..."verifies. - A golden replay of the session's three worst commands (the regex echo,
git log --grep,python -c "import fastapi; print(...)") shows none of them settles a verdict.
- Invert
- Order. fix(review): criteria commands run in the reviewed project's environment with a measured python timeout #847 (criteria environment and timeout) lands with or right after this item, or the evidence rule leaves almost nothing verifiable: 34% of commands that import the subject timed out at 5 s.
Scope added 2026-10-02: in the branch reviews of release/v0.2.25, the response cache replayed 192 and 238 persona replies (sessions 20261002-163203 and 20261002-180320) but only 3 and 6 verifier replies, because the verifier prompt changes on every run. _build_validation_prompt serialises each finding with model_dump() and drops only verified and mitigated (ai/review/verification.py:314-323). The deliverable above removes six reviewer fields. Criteria execution also writes invalidated_criteria_matched (ai/review/review_environment.py:414-422) and, on an UNVERIFIED outcome, invalidation_reason (review_environment.py:402, written at ai/review/verdicts.py:168). Both change when a criterion times out, and 28-45% of executions hit the 5 s limit in those sessions. Removing fields one by one leaves the next one in, so this item tests byte identity directly. finding_id is safe to keep: it is the finding's position in that call (verification.py:2103-2113). The release review evaluation (.data/review-evaluation-20261002.md, section 1.4) estimates 17-24 more verifier replays per run and 10-15 fewer status changes on unchanged code once it holds. One caveat: a replayed wrong verdict then repeats in every run.
- Verifying the same finding twice produces byte-identical verifier prompts. A test builds the prompt for one finding in two runs that differ only in criteria durations and stdout, one timed-out criterion, the reviewer's confidence and the
invalidation_reasona timeout leaves. It asserts the two prompts are equal. RAG is stubbed, and the test runs offline in under 1 s. It fails at 38517a8. - The findings block is built from an allowlist of the claim's own fields (
finding_id, title, description, location, severity, fix, references, category, observed and expected values, and the criteria as written), not frommodel_dump()minus a denylist. A test asserts the serialised keys equal the allowlist, so a field added toFindinglater stays out of the verifier prompt until someone adds it. - With the response cache on, verifying the same unchanged file twice reaches the model once. The test uses the real client over a fake HTTP transport, as
tests/test_ai_client_providers_and_embeddings.pydoes for persona calls, and runs offline.
Scope added 2026-10-02 from review session 20261002-214641 (.data/review-evaluation-20261002-s6.md, sections 1 and 7): a verifier reply cut at its token cap decided a verdict. JSON repair (core/serialization.py, since 22bba04) salvaged the truncated reply for ai/mcp/server.py:202 into an INVALIDATED verdict whose reason stops mid-sentence. The earlier evaluation's statement that a cut reply binds no verdict was wrong. In the same session 9 reported entries had no verdict: 5 withdrawn as self-refutations, 3 cut and 1 inconclusive.
- A verifier reply whose finish reason is
lengthbinds no verdict. Its findings stay UNVERIFIED with the no-verdict note naming the cut. A test feeds a stub reply cut mid-JSON that the repair path would salvage into INVALIDATED and asserts no verdict is applied. - The no-verdict note also covers a withdrawn self-refutation and an inconclusive reply, so every reported UNVERIFIED finding says why it has no verdict.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
fix(review): criteria settle a verdict only on evidence about the cit…
dan-petty commentedon Oct 3, 2026
Closed by #1035, merged into
release/v0.2.25.GitHub only acts on closing keywords when a pull request merges into the default branch, so this was closed by
devops gh issues close-merged.feat(release): v0.2.25 (#1089)