Skip to content

fix(review): passing criteria leave a finding for the verifier instead of verifying it, and running the cited test counts as evidence #1043

Closed

Description

@dan-petty

Problem

At the release/v0.2.25 tip (da50329), a finding that its verification criteria verify never reaches the verifier, and a false finding can now take that path.

_evaluate_criteria_verdict (src/devops_cli/ai/review/review_environment.py:476-505) returns VERIFIED with by="criteria" when one passing verification command counts as evidence and every verification command has finished (:498-504). Criteria run during deterministic pre-verification (ai/review/verification.py:1444-1447). Only an UNVERIFIED finding is shown to the verifier (_awaits_verdict, verification.py:2186-2188, used at :2267-2275), so that verdict is final. The module docstring says so: "A verdict the criteria settle is final: the model never sees the finding" (ai/review/criteria_evidence.py:3).

Before #847, criteria ran with a 5 s limit, and a script that imports this project's code often timed out: 1,310 of the 2,817 saved python criteria that import it (devops_cli or src.devops_cli) did, both of S8's chunker asserts among them. #847 (PR #1040, merged 02:14 UTC on 2026-10-03) runs them with the reviewed project's .venv first on PATH (sandbox/host.py:453-467) and a 30 s python limit (config/defaults.py:423). That widens the path. A script that imports quickly could already take it (chaos_runner.py:87-94, below).

Golden case. Review session 20261003-012555 (S8) raised src/devops_cli/ai/review/chunker.py:395 MEDIUM, "Undefined method call on PurePosixPath". It claims PurePosixPath has no full_match, so the call raises AttributeError. The claim is false: PurePath.full_match exists on Python 3.13 and later, and pyproject.toml:10 requires Python 3.14 or later. Its two verification criteria are:

  • python -c "from devops_cli.ai.review.chunker import skips_persona_review; assert skips_persona_review('some/unknown/file.txt') is False"
  • python -c "from devops_cli.ai.review.chunker import skips_persona_review; assert skips_persona_review('docs/commands/example.md') is True"

In S8 both timed out at 5 s (5.155 s and 5.003 s), and the verifier then INVALIDATED the finding. An offline replay at da50329 ran S8's finding through _validate_segment_findings, with the real bubblewrap sandbox, a read-only clone of da50329, a copy of the project's .venv and a stub verifier client:

  • Both commands exited 0, in 15.6 s and 15.2 s, at a 1-minute load of 13 on 16 CPUs.
  • The finding ended VERIFIED, verified_by="criteria", confidence 1.0. The stub was never called.
  • Run directly with the project interpreter, each command took 7.4 to 8.4 s (8.7 to 9.6 s CPU) at load 5 to 7, and 15 to 25 s at load 13 to 22. The evaluation measured 6.1 s and 7.3 s.
  • Every run is under the 30 s limit.

S9 (20261003-021501) did not raise this finding and ran no criteria. It started at da50329, but the checkout moved to 0ce4736 at 02:39:03, during its persona stage. Its verification stage then imported 0ce4736's sandbox/host.py beside da50329's review_environment.py. All 7 findings with executable criteria ended verification-unavailable: AttributeError ('HostSandboxResult' object has no attribute 'timed_out', reproduced offline with the same mix; pure da50329 runs the criteria). No review has shown the path live yet.

Why #846's evidence rule counts these commands. The rule did what it says:

  • Each script imports skips_persona_review from devops_cli.ai.review.chunker, a name the cited file imports as (_module_names, criteria_evidence.py:360-374).
  • The assert computes with that name (_uses, :244-247).
  • It compares with False or True, not None, so _tests_existence (:225-242) does not treat it as an existence test.
  • checks returns True (:269-272).

The rule answers one question: does the command run the cited code and check its outcome? It cannot answer the second one: which side of the claim does a pass support? Both asserts check the opposite of the claim, that the function returns the right value without raising. Their descriptions say so: "returns False and does not raise an exception". They are invalidation criteria filed as verification criteria, and they pass because the claim is false. src/devops_cli/ai/tasks/review.md:44 already tells the persona that verification criteria "pass only while the defect exists". The direction depends on what the claim means, so no AST rule can check it. Only the verifier can.

History agrees. A replay of da50329's counts_as_evidence over the 1,456 criteria verdicts saved in 20 sessions (574 VERIFIED, 882 INVALIDATED) finds:

  • 0 of the 574 VERIFIED rest on a command that counts. S8's chunker case would be the first, and it is false.
  • Over all 2,292 passing verification commands (once per finding), 2 count. Both are on src/devops_cli/k8s/chaos_runner.py:87-94 CRITICAL in 20260928-201857, "Insecure Namespace Validation Allows Privilege Escalation", and passed in 4.2 s and 4.8 s. Both check that the code rejects the namespaces .. and /etc, the opposite of the claim, as S8's asserts do. A passing invalidation print that does not count made the finding non-discriminating at da50329, and the verifier INVALIDATED it. Without that print, a false CRITICAL would be VERIFIED by criteria, and the CRITICAL cap would not apply.
  • 4 of the 882 INVALIDATED do. 2 test the claim directly (exceptions/security.py:48 and ai/review_schema.py:767-770). 2 test a success path beside the claim (commands/install_tools.py:225 in 20261001-224227, telemetry/memory_profiler.py:339-350 in 20260928-201857). All 4 outcomes are right (one person's judgment).

A criterion that runs the cited test does not count. In S8, tests/test_rag_multi_project_indexer.py:66 LOW claims the test raises TypeError when it builds DummyEmbedder. Its invalidation criterion imports test_multi_project_indexing, the test that spans line 66 (defined at :24), and calls it. The command exited 0 in 4.135 s in S8 and 7.6 s in the replay, which refutes the claim. counts_as_evidence returns False, because the script holds no assert, raise or exit: the check is the test's own asserts. The finding went to the verifier, the reply was cut, and it was reported as LOW UNVERIFIED. Wrapping the same call in a trivial assert ... is None makes it count.

Calling the cited test is common, and it shows why the verdict change must come first. In saved sessions, more than 70 distinct criteria call a test function imported from the cited test module. Such a call passed on 11 findings:

  • 2 as an invalidation criterion alone: this test_rag:66 case in S5 (20261002-205520), where it settled INVALIDATED before fix(review): grep-only criteria neither verify nor invalidate a finding, and prompt examples stop teaching them #846's rule, and in S8.
  • 5 where the persona filed the same call on both sides, all titled "Incorrect assertion in ..." (tests/test_review_prompt_guardrails.py:50, :64, :80, :98 and :119 in 20261001-224227). Both sides pass, so the non-discriminating rule leaves them UNVERIFIED.
  • 4 as a verification criterion alone, on claims that a test is wrong or too weak. A passing run does not confirm such a claim. tests/test_pipeline_protocol.py:114 was VERIFIED by criteria this way in 20260928-201857, and :114-117 again in 20261001-224227. The others are tests/test_finding_repetition_compression.py:60-85 and tests/test_watchers.py:30, both in 20261001-224227.

If the test call counted while a criteria VERIFIED stays final, those 4 passes would settle VERIFIED by criteria.

Two leftovers depend on criteria VERIFIED.

  • The hedge cap exempts a hedged title that is VERIFIED by criteria (ai/review/calibration.py:77-82, with CONST_REVIEW_EVIDENTIAL_ADJUDICATORS at config/constants.py:2974). After this fix no finding can meet it.
  • Merging two findings writes verified_by="criteria" on a VERIFIED result that has no adjudicator (ai/review_schema.py:1139). The verdict invariants already require an adjudicator on every VERIFIED finding (ai/review/verdicts.py:107-110).

Tests pin the current behaviour:

  • tests/test_executable_criteria.py:296-311, :314-331, :457-467, :545 and :604 expect ("VERIFIED", ..., "criteria", ...).
  • test_criteria_execution_verdict_finality (tests/test_verdict_writers.py:118-166) expects VERIFIED by criteria and a verifier that is never called.
  • The hedge case at tests/test_review_taxonomy_and_severity.py:129-136 expects a hedged title VERIFIED by criteria to keep HIGH.
  • docs/SDLC.md:233 says hedged titles are MEDIUM at most "unless executed criteria verified them".

Acceptance criteria

  • _evaluate_criteria_verdict never returns VERIFIED. A passing verification command that counts as evidence is recorded in verified_criteria_matched, and the finding stays UNVERIFIED, so the verifier is shown it. Criteria set no confidence on it. The parameters that only served the VERIFIED branch (verification_commands, exec_results and the completed set) go.
  • A golden test trims S8's chunker.py:395 finding to a fixture with its two commands, writes the cited file at its path under the test's root (criteria run only for a cited file that exists, verification.py:1479-1486), replays the commands as passing (recorded results with the sandbox faked, as _replaying does in tests/test_executable_criteria.py), and runs it through _validate_segment_findings with a stub client. The stub is shown the finding. When the stub reply is cut (finish_reason length) or gives no verdict, the finding ends UNVERIFIED with that note. When the stub refutes it, it ends INVALIDATED by llm. The test fails on the current code, where the finding ends VERIFIED by criteria and the stub is never called.
  • A passing invalidation command that counts still settles INVALIDATED by criteria. Passing commands on both sides still leave the finding UNVERIFIED with CONST_CRITERIA_NON_DISCRIMINATING (review_environment.py:492-493). The existing tests for both keep passing.
  • counts_as_evidence counts a python -c script that calls, as a statement, the test function whose definition spans the cited line, imported from the cited test module. It returns True for S8's tests/test_rag_multi_project_indexer.py:66 invalidation command. It returns False for a bare call to another test in the same module, and for a bare call to a cited function that is not a test. The first case fails on the current code.
  • With that command replayed as passing, the test_rag:66 finding ends INVALIDATED by criteria. The same kind of call filed as a verification criterion (golden tests/test_pipeline_protocol.py:114 from 20260928-201857) leaves the finding for the verifier.
  • No code path writes VERIFIED with verified_by="criteria". A merge of two VERIFIED findings keeps an input's adjudicator and never falls back to criteria (ai/review_schema.py:1139). The hedge exemption (calibration.py:77-82) and CONST_REVIEW_EVIDENTIAL_ADJUDICATORS are removed, so a hedged title is MEDIUM at most. A calibration test covers it.
  • tests/test_executable_criteria.py:296-311, :314-331, :457-467, :545 and :604 assert the new outcome: UNVERIFIED, with the command in verified_criteria_matched. test_criteria_execution_verdict_finality (tests/test_verdict_writers.py:118-166) asserts that the stub verifier is shown the finding and its verdict applies. The criteria row at tests/test_review_taxonomy_and_severity.py:129-136 goes.
  • The docstrings at criteria_evidence.py:1-23, review_environment.py:484-491 and calibration.py:9-10, and docs/SDLC.md:233, say what criteria settle now.
  • The new tests run offline and call no model. They use recorded criteria results instead of a sandbox, stub RAG as tests/test_review_advisory_backing.py:164-166 does, and each runs in under 1 s.
  • changelog.d/1043.md records the fix under ### Fixed. CHANGELOG.md is not edited.
  • uv run devops ci passes.
  • (person-run) On the homelab gateway, run a branch review of release/v0.2.25 at the fix commit. No candidate is VERIFIED by criteria. Every candidate with a non-empty verified_criteria_matched carries a verdict from the verifier or a verifier note. Record both counts in the PR.

Key questions

Depends on: none.
Order: lands before the v0.2.25 cut. The test-call change lands in the same PR as the verdict change, never before it: alone it would let 4 historical passes on "the test is wrong" claims settle VERIFIED by criteria. The fix touches review_environment.py (_evaluate_criteria_verdict), criteria_evidence.py, calibration.py, config/constants.py, ai/review_schema.py:1139, docs/SDLC.md and their tests. #845 edits verdict application in verification.py, not these parts.
Related: #846 (the evidence rule). #847 (the environment and limit that widened the path). #948 (the hedge exemption and the VERIFIED-first ranking). #845 (confirmations whose own reason refutes the claim). #770 (criteria rules stated in three places). #1015 (the persona prompt in this release). The scanned-clean dependency fix filed with this item.

Activity

  1. added
    type/bug
    scope/review
    priority/p1-high
    on Oct 3, 2026
  2. added this to the v0.2.25 milestone on Oct 3, 2026
  3. dan-petty commented on Oct 3, 2026

    @dan-petty
    OwnerAuthor

    Closed by #1057, 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.

  4. added a commit that references this issue on Oct 3, 2026
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

    priority/p1-highscope/reviewtype/bug

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions