Skip to content

fix(review): a one-file path review takes minutes in the payloads stage because the lockfile coverage scan walks the whole checkout and mypy starts with an empty cache #2034

Closed

Description

@dan-petty

Friction

uv run devops ai review path src/devops_cli/core/dns_names.py (one file, 2026-10-24) took 6 min 21 s and made 0 model calls. The payloads stage took 379 s of that. The owner reports that devops ai review path is "completely broken".

Evidence

A cProfile run of the same command (.data/agent/scratch/review-path.prof, not in git):

  • osv_scanner.detect_manifest_coverage_gaps: 158 s. _collect_lockfile_names (src/devops_cli/security/osv_scanner.py:203) runs tree.rglob("*") over the whole checkout, including gitignored trees such as .data/ (review sessions, agent worktrees with their own .venv). _find_unlocked_manifest_gaps runs one more rglob per manifest name.
  • pipeline._scan_lockfiles: 162 s, and pipeline._admit_scanner_findings: 201 s, which contain the scan above.
  • core.repo.list_repo_files / _list_git_tracked_files: 30.7 s, called from pipeline._collect_scanner_commit_files.
  • security.mypy.run_mypy_scan runs mypy with a new empty --cache-dir each time (tempfile.TemporaryDirectory(prefix="devops-mypy-cache-")). Cold, mypy on this file takes 71 s; with a warm cache, 2 s.
  • telemetry.tracer.flush and _send_payload_sync show about 510 s cumulative. This may be an artifact of how cProfile counts nested calls; it needs a check with wall-clock spans.
  • The scanners themselves are fast: Semgrep 16 s, Gitleaks 3 s, Bandit 1.5 s.

Proposed remedy

  • Collect lockfiles and manifests from the git file list (git ls-files, which honours .gitignore), not from rglob, and scope the coverage check to the reviewed files' projects.
  • Give mypy a persistent cache keyed by the reviewed tree and the tool lock, under the data directory, so a second review is warm.
  • Find why list_repo_files takes 30 s for one file.
  • Check whether the trace export blocks the review, with wall-clock spans or py-spy.
  • Add a test that bounds the work of a one-file review: for example, no rglob outside the git file list, and the mypy cache directory stays the same across two runs.

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 describes a performance issue that causes slow review runs and a broken user experience.
    • Priority: P1-High. The issue makes the review command completely broken and takes minutes to run for a single file.
    • Value: High. Fixing this improves developer productivity significantly by reducing review times from minutes to seconds.
    • Effort: Medium. The fix requires changes to how lockfiles are scanned, mypy caching, and potentially repository file listing logic.
    • Related: refactor(security): mypy and the review canary start their tools through a ToolExecutor #1978, which asks for a different change. Both items improve how mypy runs during reviews, but this item focuses on performance and caching while #1978 focuses on tool execution through a ToolExecutor.
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