fix(verifier): surface self-contradictory finish instead of dropping the vuln - #221
Merged
Merged
Conversation
…the vuln A verifier finish with agree=True but correct_finding diverging from the Stage-1 verdict (the finish schema declares the two fields independently, no cross-field constraint) was read as a clean agreement. The write-back consumers (_verify_one, experiment.py) only propagate correct_finding on the disagree branch, so an upgrade contradiction (stage1=safe, correct_finding=vulnerable) left result["finding"]="safe" and the vuln was dropped by the reporter's disclosure filter (core/reporter.py:283 selects finding in vulnerable/bypassable). Detect the contradiction at the shared chokepoint _parse_finish_result: take the more-severe verdict (FINDING_VERDICT_ORDER), set agree=False and incomplete=True, so it renders as "unverified" (needs manual review) rather than a droppable "agreed". One edit covers both consumers, which both reach _parse_finish_result via verify_result. Mirrors the file's existing R4-7 degenerate-path fail-safe. The false-negative is reachable via the experiment.py --verify flow (verifies all Stage-1 results); the production scanner (core/verifier.py) pre-filters to vulnerable/bypassable, so on that path a downgrade contradiction conservatively keeps the vulnerable finding surfaced. Tests: tests/test_famreport2_agree_contradiction.py (8; RED 4-fail pre-fix, covering both contradiction directions + regression guards). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
gadievron
requested review from
dgeyshis,
shahar-davidson and
sounil
as code owners
August 8, 2026 08:11
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Surface a self-contradictory Stage-2 verifier
finishinstead of silently dropping the finding it carries.Why
The verifier's
finishtool schema declaresagreeandcorrect_findingas independent required fields with no cross-field constraint (utilities/finding_verifier.py:153-199), so a model can returnagree=True(claims to agree with the Stage-1 verdict) whilecorrect_findingnames a different verdict._parse_finish_resulttookagreeverbatim, and the two write-back consumers (_verify_one:740,experiment.py:590) only copycorrect_findingintoresult["finding"]on theagree==Falsebranch. So an upgrade contradiction — Stage-1safe,correct_finding=vulnerable— leftresult["finding"]="safe", and the reporter's disclosure filter (core/reporter.py:283, which selects onfinding in ("vulnerable","bypassable")) dropped the vulnerable finding from the report.The drop is reachable via the
experiment.py --verifyflow, which verifies every Stage-1 result (experiment.py:551-552). The production scanner path pre-filters to vulnerable/bypassable before verification (core/verifier.py:101-105), so on that path a downgrade contradiction conservatively keeps the vulnerable finding surfaced.How
utilities/finding_verifier.py::_parse_finish_result: on a contradiction (agree==Trueandcorrect_finding != Stage-1), take the more-severe of the two verdicts, setagree=Falseandincomplete=True, then return that. The reporter renders it asunverified(needs manual review) rather than a droppableagreed._more_severehelper ranks by the existingFINDING_VERDICT_ORDER(core/verdict_taxonomy.py:32), so a vulnerable reading on either side is kept and a downgrade cannot silence a real Stage-1 verdict._verify_oneandexperiment.pyboth reach_parse_finish_resultviaverify_result. Mirrors the file's existing degenerate-path fail-safe (which also returnsagree=False+incomplete=True).Observed: a contradictory finish now increments the
needs_reviewbucket (core/verifier.py:280) and rendersstage2_verdict="unverified"(core/reporter.py:390) instead of vanishing.Tests
tests/test_famreport2_agree_contradiction.py(8 tests): both contradiction directions, both consumers (via a mirror of the write-back branch + the verbatim reporter filter), a non-vuln-vs-non-vuln edge, and 3 regression guards for normal agree/disagree/missing-agree.Compatibility
Behavior change on the production path only for a self-contradictory finish: a finding previously labeled
agreed/confirmeddespite the model contradicting itself now rendersunverified(needs review). It stays surfaced either way. No API, schema, or signature changes. No changes to core/parsers/reachability.Author notes
utilities/finding_verifier.py_parse_finish_result: theif agree and correct_finding != original_finding:block (setscorrect_finding = _more_severe(...),agree=False,incomplete=True) plus the_more_severehelper and theFINDING_VERDICT_ORDERimport.finish(agree=True, correct_finding="vulnerable")over a Stage-1safefinding: before,result["finding"]stayed"safe"and the reporter dropped it; nowresult["finding"]becomes"vulnerable"withincomplete=True, so it appears as an unverified finding for review.correct_findingonagree==Truetoo?" Because that would overrideagreewithcorrect_findingon every normal turn; the contradiction path is the only place the two disagree, and there the safe move is to surface for review, not to silently pick a side.