Skip to content

feat(ai): ai review honours an inline intent marker with a quoted reason #602

Closed as not planned

Description

@dan-petty

Context & Rationale

Intent is read only by prompts (ai/tasks/review.md:9, ai/personas/challenger/prompt.md:4, ai/tasks/verify_finding_system.md:33); AGENTS.md:401 forbids flagging fixtures, tutorials and explanatory comments. The one deterministic case, _check_test_fixture_credential_hallucination (ai/review/verification.py:812), invalidates a credential claim under a tests/fixtures path only when every cited value matches _PLACEHOLDER_SECRET. Nothing in _deterministic_pre_verification (:1179) reads a docstring or comment, so a finding on code that declares itself a negative fixture stays reportable. #435 added observed/expected polarity, not intent. vibes flagged an unused stopCh in a function commented "Flawed pattern: infinite loop without select on stopCh". That free-text comment would not match the marker proposed here: the value depends on repos adopting it, the trade-off noqa and nosec make.

Scope & Deliverables

  • Context & Rationale*: Intent is read only by prompts (ai/tasks/review.md:9, ai/personas/challenger/prompt.md:4, ai/tasks/verify_finding_system.md:33); AGENTS.md:401 forbids flagging fixtures, tutorials and explanatory comments. The one deterministic case, _check_test_fixture_credential_hallucination (ai/review/verification.py:812), invalidates a credential claim under a tests/fixtures path only when every cited value matches _PLACEHOLDER_SECRET. Nothing in _deterministic_pre_verification (:1179) reads a docstring or comment, so a finding on code that declares itself a negative fixture stays reportable. feat(cli): verdict polarity & field distribution assertions #435 added observed/expected polarity, not intent. vibes flagged an unused stopCh in a function commented "Flawed pattern: infinite loop without select on stopCh". That free-text comment would not match the marker proposed here: the value depends on repos adopting it, the trade-off noqa and nosec make.
  • Deliverable*: Honour one project marker carrying a non-empty reason, and nothing else; AI findings carry no rule id, so # nosec cannot be matched. It counts only on the cited line, the line above, or the enclosing def's docstring, found with construct_validator.collect_ast_constructs and read via _cited_window. Python first; other languages later through tree-sitter comment nodes from grammars already pinned (pyproject.toml:42-54). A marked finding becomes MITIGATED with the marker line quoted in invalidation_reason, which reports already render as "Mitigation" (ai/review/pipeline.py:2770); no new status. Add golden cases (tests/golden/review_findings.json): a marked negative fixture comes out MITIGATED; an unmarked shell=True beside the word "deliberate" stays in real_defects. A second PR adds the diff guard and corpus check below.
  • Constraint*: derive_recommendation (ai/review_schema.py:1103) excludes MITIGATED from the merge verdict, so in devops review pr the diff author would control suppression. A marker on a line the diff adds or changes must not move the finding and is itself reported. A path or free-text keyword must never decide: verify_finding_system.md:55 forbids invalidating a real vulnerability for where it lives, and matching "deliberate" repeats the single-word risk the catalog refuses (common_hallucinations.py:1074). generate_corpus (ai/review/defects.py:1315) must reject output carrying the marker, or measured recall inflates. SARIF is out of scope: security/sarif.py serves only devops scan (commands/scan.py:839).
  • Measured*: .venv/bin/python probe/probe.py probe/value_intent_root (scratch fixtures): of 3 findings, 2 on code whose docstring and comment declare it deliberate stayed UNVERIFIED with reportable=True; only the placeholder credential, which has no comment, was invalidated. python3 -c "import json,collections; d=json.load(open('src/devops_cli/ai/review/common_hallucinations.json')); print(len(d), collections.Counter(i['category'] for i in d))": 1 of 27 builtin entries is test_mocks.
  • Source*: vibes artifacts/prompts/multi-persona-code-reviewer.md, vibes patterns/findings-must-carry-their-own-falsification.md

Strategic Alignment

  • Milestone: v0.2.23 (devops ai Review Quality, LLM Routing & Multi-Language Validation)
  • Roadmap Reference: docs/ROADMAP.md

Activity

  1. added this to the v0.2.23 milestone on Sep 25, 2026
  2. added
    type/feature
    scope/ai
    priority/p2-medium
    on Sep 25, 2026
  3. modified the milestones: v0.2.23, v0.2.24 on Sep 28, 2026
  4. removed this from the v0.2.23 milestone on Oct 1, 2026
  5. dan-petty commented on Oct 1, 2026

    @dan-petty
    OwnerAuthor

    Moved from the shipped v0.2.23 to the backlog. It is still valid (checked 2026-10-01), and P2 items don't displace P1 work in the planned releases.

  6. added
    scope/review
    and removed
    scope/ai
    on Oct 2, 2026
  7. 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 (intent markers that only prompts read) is superseded by #871, re-scoped on 2026-10-03 as the redesign's single admission step: findings carry their producer's anchor, a location checked against the reviewed commit, severity from the tool and a policy table, and suppressions read at the base revision.

    It stays open, labelled status/blocked, and closes as not planned with "Superseded by #871" when #871 lands. Merging it into #871 now was proposed by the consolidation; that is left to a person.

  8. added
    status/blocked
    on Oct 3, 2026
  9. dan-petty commented on Oct 8, 2026

    @dan-petty
    OwnerAuthor

    Closing as not planned: superseded by #871 (PR #1278, v0.2.28), as the 2026-10-03 note and #1137 planned. Suppressions now come from .devops/review.toml with a reason and an optional expiry (review/suppression.py). An inline marker counts only for its own tool (config/constants.py:686-690), and a marker the change itself adds leaves the finding OPEN (review/admission.py:31). This item asked for a marker on model findings, which #1151 deletes.

    Found by the 2026-10-08 backlog review.

  10. removed
    status/blocked
    on Oct 30, 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/feature

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions