Skip to content

fix(review): the report ranks verified findings first, keeps only scanned advisories, and uses one category taxonomy and calibrated severity #948

Closed

Description

@dan-petty

Problem

Review session 20261001-224227 reported "563 reportable findings (21 Critical, 263 High)" and headlined CVE-2021-44228 (Log4Shell). A triage of all 563 against the code found 46 real defects, none above MEDIUM, and no CVE that applies. The report's integrity failures are code, not model output:

  • Ranking. sort_findings (review_schema.py:1094) orders by model confidence before verification status, so UNVERIFIED findings at confidence 1.0 rank above VERIFIED ones at 0.95.
  • Headline. The executive summary (stages/reporting.py:157) names the themes of the first-sorted findings. The theme (:20) is the first reference, so a hallucinated CVE becomes the headline.
  • Patterns. "Key Bad Patterns" has 280 bullets, 257 of them singletons and 232 keyed by an issue title.
  • Good patterns. "Static analyzers … with 0 critical findings" is a hard-coded literal (:89). Bandit, Semgrep and Pluto failed in that run.
  • Counts. The counts mix VERIFIED, UNVERIFIED and MITIGATED. 76 findings marked verification-unavailable and 28 MITIGATED are counted as defects.
  • References.
    • 11 CVEs from other products (Log4j, polkit, Apache httpd, OpenSSH, axios, JUnit) were cited against a Python CLI whose 58 dependencies the same run scanned clean.
    • Nothing compares references with this run's dependency scan.
    • placeholder_advisory matches only x/n/? runs.
    • _check_scanned_clean_dependency never fires on path reviews, because _verify_single_file_payload passes no dependencies (pipeline.py:2661).
    • On the runner path it reads model-written external_dependencies.
  • Taxonomy. 148 distinct free-text category strings. Finding.category is a free str, and resolve_finding_category only lowercases it.
  • Severity.
    • 54% of candidates are HIGH, the value in both prompt examples.
    • The verifier may raise severity.
    • Tests and docs findings are rated CRITICAL or HIGH (25 of 27 reported test findings).

Acceptance criteria

  • Ranking. sort_findings orders by (not reportable, status VERIFIED < UNVERIFIED < MITIGATED, severity, location, title), with no model confidence.
  • Headline. Themes come from VERIFIED findings only, ranked by (max severity, count). Singleton themes are cut, and a theme is never a finding title.
  • Counts. They are split by status, with verifier-unavailable and MITIGATED findings listed apart.
  • Analyzer line. It is computed from scanner results and names analyzers that failed.
  • Advisories.
    • A CVE or GHSA id stays in references only if a DependencySpec.vulnerabilities entry of this session carries it (by id or alias). Otherwise it is stripped, with a note.
    • A finding whose only evidence was that advisory is INVALIDATED deterministic:unbacked_advisory.
    • The session's dependencies reach _verify_single_file_payload.
    • Model-written external_dependencies and network_references are cleared on parse.
    • The placeholder pattern also catches sequential ids such as CVE-2023-1234.
  • Taxonomy.
    • A validator maps category to CWE-<n> when one appears in the category or references. Otherwise it maps through a keyword table to a closed DefectClass enum, keeping the original as category_raw.
    • One theme function serves the metrics and the report.
  • Severity.
    • The verifier may only lower severity; the persona's value is kept as severity_raw.
    • Findings in tests and docs are LOW at most unless they concern a verified secret.
    • Hedged titles ("Potential", "May", "Could") are MEDIUM at most unless VERIFIED by evidential criteria.
    • CRITICAL requires VERIFIED.
  • Path routing. Planning documents (docs/ROADMAP.md, CHANGELOG.md, changelog.d/, docs/agent/tasks/, ADRs) and generated reference docs (docs/commands/*.md, docs/CLI_REFERENCE.md) are excluded from path reviews.
  • Tests.
    • Crafted findings, including an UNVERIFIED CRITICAL that cites CVE-2021-44228, never put that CVE in the headline.
    • One analyzer with critical findings never yields "with 0 critical findings".
    • A parametrised mapping over that session's 148 category strings gives at most about 30 classes and no None.
    • A table test covers the severity caps.
    • tests/test_review_report_summary.py:188 is updated to the new rules.
  • uv run devops ci passes.

Key questions

Scope added 2026-10-02: the Path routing criterion above covers path reviews only. Branch and PR reviews paginate the whole diff (_prepare_branch_content, ai/review/runner.py:1828-1892, pages at :1887; _prepare_pr_content, :1895-1937, pages at :1936). The only files they skip are lockfiles (_is_generated_diff_block, ai/review/chunker.py:383-390), and path reviews skip the same lockfiles through a second check (runner.py:1449). In the branch reviews of release/v0.2.25, the paths this item routes took 58 of 214 persona pages in the cold run 20261002-142541 (27%) and 77 of 319 in 20261002-180320 (24%). They produced 14 of 72, 23 of 100 and 23 of 126 reported findings in the first three runs. 1, 6 and 8 of those were VERIFIED, so the new ranking would put them first. A hand triage of 20261002-180320 found none of its 23 valid. Lockfiles still reach Trivy through _lockfiles_beside (ai/review/pipeline.py:507-516). Routed files need the same for the secret scan, because a secret pasted into a task file or changelog fragment is still a secret. One more trap: when every changed file is skipped, the page builder yields one empty page (chunker.py:431-432). The orchestrator then finds no files and returns None before the scanners run (runner.py:2103-2104), and the workflow falls through to the legacy engine, which sends the empty page to the model (runner.py:2287). Routing changelog fragments and task files makes that common: a docs-only branch would hit it.

  • Branch and PR reviews apply the same path routing as path reviews. One predicate decides it for all three targets and replaces the two lockfile checks (runner.py:1449, chunker.py:383-390).
  • A test feeds a unified diff that touches src/app.py, changelog.d/1.md, docs/agent/tasks/task-1-x.md, docs/ROADMAP.md, docs/commands/ai.md and docs/CLI_REFERENCE.md through the branch review's page builder. It asserts that only src/app.py reaches a persona page. The PR path is checked the same way with a fake GitHub client. Both run offline.
  • A routed file still reaches the secret scan. A test with run_gitleaks_scan faked asserts that a changed changelog.d/1.md is passed to it.
  • A branch or PR whose changed files are all routed out makes no model call and does not reach _run_persona_loop. It still runs the secret scan on those files and says that nothing was left for the personas. A test with a diff that touches only changelog.d/1.md and a fake model client asserts both.

Scope added 2026-10-02 from review session 20261002-214641 (.data/review-evaluation-20261002-s6.md, section 4.1): the executive summary counts Gitleaks among "6 static analyzer(s) executed" (ai/review/stages/reporting.py:88), although it ran only built-in patterns because its binary is not installed. All 5 HIGH findings in S5 and S6 were false or overrated.

  • The executive summary counts an analyzer as executed only when its state is ran, and names built-in patterns separately.

Activity

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

    @dan-petty
    OwnerAuthor

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