Skip to content

fix(review): the review pipeline reports the eight failures it now swallows, and reads a file in one place #2160

Description

@dan-petty

What happened

ai/review/pipeline.py has 15 except Exception handlers at b170358, and 19 sites that the swallowed-failures ratchet counts (BLE001, S110, S112). Eight of the handlers hide a failure that changes what the review checks, and the review does not say so:

Line Function What the user does not see
274 _try_reuse_cached_analysis_meta a cache entry that failed to validate (logged at debug level)
404 _collect_scanner_commit_files list_repo_files failed, so the secret scan gets fewer files (pass)
558 _file_content a file that failed to read is read as absent
887 _analyze_path the pre-analysis of a file failed, so the file has no metadata
922 _collect_paths_to_analyze a path that failed to prepare is dropped (debug log)
2082 __init__ find_repo_root failed, so the path classes load without the repository's configuration (pass)
2563 _fetch_threat_intel the network references of a file were not extracted (debug log)
2640 _read_content a second copy of _file_content, with the same behaviour

A test that only covers these handlers would lock the swallow in. The fix is to handle or report each cause (AGENTS.md rule 11).

What should happen

Each of the eight handlers catches only the errors that its call raises. A failure that changes the scope of the review reaches the report as a coverage gap with its reason, as errored_files already does at line 2780 for a payload that fails. A failure that changes nothing the user relies on, such as a cache miss, is not caught as Exception. The two copies of the file read become one.

Evidence

At b170358:

  • src/devops_cli/ai/review/pipeline.py: the lines in the table.
  • uv run ruff check --select BLE001,S110,S112 src/devops_cli/ai/review/pipeline.py: 19 sites. tests/fixtures/swallowed_failures_ceilings.json holds 19 for the file.
  • :2780-2784 records the error of a file in errored_files and warns. That handler reports its cause, so it stays.

Out of scope, because open issues own them:

Acceptance criteria

  • Tests first: a review where list_repo_files fails, where a file read fails, where the pre-analysis of a file fails, and where find_repo_root fails. Each test checks that the report or the session names the gap and its reason. The tests fail on today's code.
  • None of the eight handlers catches Exception. _file_content and _read_content are one function.
  • The swallowed-failures ceiling of ai/review/pipeline.py goes down by the sites this change removes (uv run python -m tests.test_swallowed_failures_ratchet --lower).
  • The tests run over the model, tool-executor and process fakes, and patch no devops_cli name (docs/TESTING.md).
  • uv run devops ci passes.

Related: #1328 (the ai/review tests move onto fakes), #1907, #1429, #1165.

Source: #1907

regression of #423

Activity

  1. added
    source/agent
    type/bug
    on Oct 24, 2026
  2. dan-petty commented on Oct 24, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones on the board.

    • Type: type/bug. The candidate fixes a bug in the review pipeline's exception handling.
    • Priority: P1-High. The fix addresses hidden failures that change the scope of reviews.
    • Value: High. The change improves correctness and transparency of the review process.
    • Effort: Medium. Requires modifying multiple exception handlers and adding tests.
  3. added a commit that references this issue on Oct 24, 2026
    da401c6
  4. added a commit that references this issue on Oct 24, 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

    source/agenttype/bug

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions