Skip to content

fix(review): a finding that cites a removed symbol keeps its mark, the verifier sees the removed lines, and a refutation of it stands #1018

Closed as not planned

Description

@dan-petty

Problem

Branch and PR reviews know which symbols their diff removed (#593). When a finding names one, validate_construct_location does not invalidate it for citing a construct the file lacks. It moves the finding to the nearest diff hunk and sets verification_note = "cites removed symbol" (src/devops_cli/ai/review/construct_validator.py:396-414, reached from :466-467). That note is the only mark. It keeps the finding from the model (src/devops_cli/ai/review/verification.py:2105-2112 and :2046), and it is what removed_symbol_findings_count and the report's "Removed-Symbol Findings" line count (src/devops_cli/ai/review/pipeline.py:3683-3685, src/devops_cli/ai/review/runner.py:450 and :683-690).

The mark does not survive pre-verification. Right after the construct check, _run_file_level_deterministic_checks runs the finding's criteria (verification.py:1337-1341). When the finding has an executable verification criterion, or an invalidation criterion passes, _reconcile_finding_from_criteria applies a verdict through apply_verdict (src/devops_cli/ai/review/review_environment.py:432-443). Every status apply_verdict writes sets verification_note, to None when no note is given (_build_verdict_updates, src/devops_cli/ai/review/verdicts.py:121-186, applied by apply_verdict at :189-234). So a finding with executable criteria loses its mark, goes to the model, and is not counted. removed_symbol_findings_count was 0 in the four branch reviews of release/v0.2.25 (sessions 20261002-142541, -163203, -180320 and -200610), whose diffs removed 94, 160, 177 and 184 symbols. The #593 test test_verification_exempts_only_a_real_removal_and_the_summary_counts_it (tests/test_review_symbol_delta.py:305-337) passes because its findings carry no criteria.

At the model, a refutation of such a finding cannot stand. _validate_citation_line (verification.py:1615-1668) turns an INVALIDATED verdict into UNVERIFIED when the cited line holds none of the finding's construct tokens (:1645-1667). A deleted symbol is on no line of the head file.

The case in the data is "Removal of DynamicWorkflow Capability Introduces Critical RCE Vulnerability", CRITICAL, on src/devops_cli/ai/harness/workflow.py, after #964 deleted DynamicWorkflow (d5e5c08). Replayed at 38517a8 with S3's finding, session metadata and diff, a criteria runner faked to fail all four commands (in S3 all four timed out at 5 s), and a fake verifier that refutes it citing line 394:

  • the construct check moves it from :408-722 to the hunk :394-399 and marks it;
  • the criteria step clears the mark;
  • the model is asked, and its refutation becomes UNVERIFIED with "Refutation cited line 394 does not contain cited construct tokens; downgraded to UNVERIFIED";
  • the finding ends UNVERIFIED and reportable.

Sessions -163203 and -180320 reported it with exactly that note, and in -180320 it was the only CRITICAL. Session -200610 reported it again, UNVERIFIED with no note.

Restoring the mark alone does not help. The same replay with the criteria removed keeps the mark, never asks the model, and ends UNVERIFIED and reportable, still CRITICAL. The exemption stops a wrong invalidation, since the symbol is absent because the diff removed it. It also stops every verdict. The verifier could not judge the removal anyway: its context is the head file (pipeline.py:2669), and the diff text is used only to find hunks (verification.py:2097).

Changes since the evaluation: #949 (e4ea2e0) and #951 (38517a8) did not touch this path. Lines here are cited at 38517a8. #987 (b1fddd0) and #1009 (79e1e93) merged after it and moved pipeline.py lines down by about 170, without changing the functions cited.

Acceptance criteria

  • The mark is a field, not a note. Finding gets removed_symbol: SkipJsonSchema[str | None] = None, the symbol the finding cites, set where the construct check sets the note today. apply_verdict and the criteria step never clear it. The pipeline copies it back with the verdict fields (pipeline.py:2687-2708, or fix(review): grep-only criteria neither verify nor invalidate a finding, and prompt examples stop teaching them #846's VERDICT_FIELDS if that has landed). It is not in the persona schema, as relocated_from is not (src/devops_cli/ai/review_schema.py:613), and not in the verifier prompt's findings JSON. A persona reply cannot set it: reset_verification_state (review_schema.py:1282-1303) and _strip_model_set_verification_state (:1306-1317) clear it as they clear verification_note, and a test feeds a reply that sets it.
  • removed_symbol_findings_count, the report line and the markdown summary count the field. No code compares verification_note with "cites removed symbol" any more.
  • A marked finding is still never invalidated by the construct check. It is sent to the model verifier like any other UNVERIFIED finding.
  • A marked finding's code section in the verifier prompt includes the removed lines of the diff hunk it was moved to, under a label that says they were removed from the file. They are masked and boundary-sanitized as the rest of the code section is. They start at the line that defines the removed symbol and stop after 81 lines, or at the end of the hunk. When a hunk's removed lines define the symbol, the construct check moves the finding to that hunk rather than to the nearest one (_find_closest_diff_hunk, src/devops_cli/ai/review/construct_validator.py:388-393).
  • An INVALIDATED verdict on a marked finding stands when its citation line falls inside the finding's hunk. A citation outside the hunk is checked as today. VERIFIED and MITIGATED verdicts are unchanged.
  • A refutation of an unmarked finding whose cited line lacks the finding's construct is still downgraded.
  • A replay test in tests/test_review_symbol_delta.py, whose review_repo fixture already builds a base, a head and a diff, covers the DynamicWorkflow case. It uses the S3 finding with its four python -c criteria (two verification, two invalidation), a head file and a diff that removes the class, a criteria runner faked to fail, and a fake verifier that refutes it citing a line in the hunk. The finding ends INVALIDATED with removed_symbol == "DynamicWorkflow", the session counts 1 removed-symbol finding, and the verifier prompt holds the removed class DynamicWorkflow line. It fails on the current code.
  • test_verification_exempts_only_a_real_removal_and_the_summary_counts_it follows the new rule. The legacy_helper finding is sent to the model once, with its hunk in the prompt. ghost_fn is still INVALIDATED with no model call. The count stays 1. A variant gives the legacy_helper finding a failing executable criterion and expects the same.
  • The tests run no real criteria command and no network, in under 1 s together.
  • changelog.d/1018.md records the fix under ### Fixed. CHANGELOG.md is not edited.
  • uv run devops ci passes.
  • (person-run) In a scratch repository whose branch deletes a function that another file calls, devops review branch with a live model reports at least 1 removed-symbol finding when a finding names the function. The finding carries a verdict with a reason, or a no-verdict note.

Key questions

Depends on: none.
Order: after #846 and #845 (v0.2.25). All three change the verdict path in verification.py, #845 extends the evidence check that _validate_citation_line makes for INVALIDATED verdicts to VERIFIED and MITIGATED ones, #846 extends reset_verification_state, and #846 replaces the copy-back at pipeline.py:2687-2708, which must carry the new field. If #1017 is scheduled, land it first: both change how _build_validation_prompt builds its code section.
Related: #593 (shipped the exemption). #845 and #846 (verdict evidence and criteria). #948 (CRITICAL requires VERIFIED). #947 and its PR #964 (deleted DynamicWorkflow). #996 (one finding verifier; this logic moves into it). #901 (renamed files keep their removed symbols). #1017.

Activity

  1. added
    type/bug
    scope/review
    priority/p2-medium
    on Oct 2, 2026
  2. dan-petty commented on Oct 3, 2026

    @dan-petty
    OwnerAuthor

    Frozen by the evidence-first review redesign (#1137, owner direction of 2026-10-03): patches to the model generator and verifier stop, and tool-layer fixes continue. This item patches code that #1150 deletes (the verifier path in verification.py, the guards and verifier prompts, construct_validator.py, criteria_evidence.py, and the known-false-positive catalog).

    It stays open, labelled status/blocked, and closes as not planned with "Superseded by #1150" when that item lands. Until then, the interim is the tools-only review (--no-persona-review --no-verification). Do not start work on it.

  3. added
    status/blocked
    on Oct 3, 2026
  4. dan-petty commented on Oct 17, 2026

    @dan-petty
    OwnerAuthor

    Closed as not planned in the 2026-10-17 unblocking review: Superseded by #1150. construct_validator, verification and the 'cites removed symbol' note are deleted. Admission uses the tool's own path and line.

  5. removed
    status/blocked
    on Oct 17, 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/p2-mediumscope/reviewtype/bug

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions