Skip to content

fix(review): review path --watch reviews only the files that changed #1067

Closed

Description

@dan-petty

Problem

devops review path --watch reviews every target again whenever any watched file changes. Lines are at release/v0.2.25 (e3ff98c).

  • DebouncedFileWatcher passes the changed paths to its callback (src/devops_cli/watchers/file_watcher.py:100-107).
  • _on_change(changed) (src/devops_cli/commands/review.py:393-395) uses them only to print a count. It then calls _execute_current_review() (:335-387), which builds pages from every target in path_targets (:336-368) and runs the whole workflow.
  • --watch runs no review when it starts (:389-404). It waits for the first change.

So devops review path src --watch reviews all of src after each save:

  • With the reply cache on, unchanged pages replay from the cache. Pre-analysis, the static scan, the per-file RAG lookups, verification and the report still run over every target, and each run writes a new session for all of them.
  • With --no-cache or --force, every page goes to the model. For a whole-repository target that is a full review per save: S9 (20261003-021501, 356 files) took 2,152.7 s with 371 model calls [measured: profile.json].
  • The slow-tier plan routes --watch to the background tier (devops-background, qwen3-coder on hog at about 47 tok/s, one request at a time), where a full re-review per save cannot keep up.

Source: .data/slow-tier-plan-20261003.md, section 4 (--watch), re-read at e3ff98c.

Acceptance criteria

  • On a change, --watch reviews only the changed files:

    • those that still exist;
    • lie under one of the targets;
    • and pass the same --pattern and reviewable-file filters a path review applies.

    They form one path-review session. A deleted file is skipped. A change with no reviewable file prints one line and runs no review.

  • The same stage flags, personas, concurrency and clients apply as for the full targets. Only the pages change.

  • A test drives the review path --watch command with DebouncedFileWatcher.watch patched to call on_change([<tmp>/a.py]) once, over a target directory holding a.py and b.py. It asserts that _execute_review_workflow receives pages for a.py only. It fails on the current code, which sends both. A second case passes only a deleted path and asserts that no review runs.

  • HELP.options.watch, which only review path uses (review.py:286), says that each change reviews only the changed files.

  • The tests run offline, use a fake review workflow, call no model, and each runs in under 1 s.

  • uv run devops ci passes.

  • (person-run) Run devops review path src --watch and save one file. The new session's profile.json lists that file alone.

Key questions

  • Does a file reviewed alone lose context from the files around it? (proposed) No more than in any path review of one file. Linked-file context and RAG lookups still read the repository; only the pages under review shrink.
  • Should --watch start with a full review? (proposed) Not in this item. Today it waits for the first change, and a person who wants a baseline runs the command once without --watch.
  • Several files saved within the debounce window? (proposed) One session with all of them. The watcher already batches them (--debounce-ms, default 500).
  • Does review branch or review pr have the same loop? (proposed) No. --watch exists only on review path (review.py:284-287).
  • Is this P1? (proposed) No, P2. It wastes time and slots but loses nothing, and the reply cache absorbs the persona calls for unchanged pages.

Depends on: none.
Order: #995 (delete the legacy segment engine) and #1047 (a branch review reads the commit it reviews) also edit commands/review.py, in other functions. Whichever lands second rebases.
Related:

Activity

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

    @dan-petty
    OwnerAuthor

    Review redesign (#1137, 2026-10-03): linked to phase P3's tool-run cache (P3-3), not re-scoped. This item keeps its --watch fix unless the owner accepts the re-scope.

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