Repository navigation
Description
OpenCodeReview version
Observed with v1.7.9. Verified by source inspection to remain present in v1.7.15.
Operating system
Linux x86_64 on GitHub Actions.
Installation method
npm global installation with an exact OCR version.
LLM provider
Other OpenAI-compatible endpoint. This accounting defect is provider-independent.
Bug description
The JSON files_reviewed field can count files that were never dispatchable or reviewed, so it does not reliably reconcile with preview-selected files or actual per-file execution.
In v1.7.15:
- Preview/countReviewable excludes deleted files: https://github.com/alibaba/open-code-review/blob/v1.7.15/internal/agent/preview.go#L59-L99
- The review pipeline retains deleted diffs through regular filtering, while dispatch later skips deleted files: https://github.com/alibaba/open-code-review/blob/v1.7.15/internal/agent/agent.go#L189-L235 and https://github.com/alibaba/open-code-review/blob/v1.7.15/internal/agent/agent.go#L350-L450
- files_reviewed is reported from len(a.diffs), not from the dispatchable/completed file set: https://github.com/alibaba/open-code-review/blob/v1.7.15/internal/agent/agent.go#L260-L263
Large-diff filtering also occurs at a different stage, which can move the count in the opposite direction. Consequently, preview-selected, dispatched, completed, and files_reviewed do not share one documented vocabulary.
Production evidence:
- Run: https://github.com/vybestack/llxprt-code/actions/runs/29946076923
- Job: https://github.com/vybestack/llxprt-code/actions/runs/29946076923/job/89011650080
- PR files: https://github.com/vybestack/llxprt-code/pull/2610/files
The preview selected 63 files, while final JSON reported 68 files_reviewed. The PR contained six removed files. Deleted files retained in the broad diff collection but skipped by dispatch explain why the reported value can exceed the selected/dispatchable count; later large-diff filtering can offset part of that difference. The exact +5 composition is less important than the direct source-level accounting mismatch.
This makes runtime, cost, completeness, and regression measurements unreliable. It also prevents downstream automation from distinguishing complete coverage from an inflated aggregate count.
Steps to reproduce
- Create a review range containing:
- at least one modified reviewable file;
- at least one deleted file;
- optionally one file excluded by the large-diff filter.
- Run preview with JSON output and record total/excluded/selected counts.
- Run the review over the same exact range and record files_reviewed and any per-file/session records.
- Observe that files_reviewed is derived from the retained diff slice rather than the files actually dispatched or completed.
A deterministic unit/integration test can avoid provider calls by exercising preview, filtering, dispatch eligibility, and result assembly over fixture diffs.
Expected behavior
Define one documented file-accounting vocabulary and use it consistently in preview, JSON, sessions/manifests, and telemetry. At minimum distinguish:
- total diffs;
- eligible files;
- selected files;
- prefiltered or oversized files;
- dispatched files;
- reused files;
- completed files;
- failed files;
- waived/skipped files;
- deleted files.
For the legacy files_reviewed field:
- It must not include deleted or otherwise undispatched diffs.
- Its exact meaning must be documented, preferably completed plus safely reused files.
- Preview must apply the same relevant selection stages as review execution, or clearly report why later prefilters can change scope.
- JSON and OpenTelemetry counters must reconcile.
- Terminal success/no-findings must not be inferred from an inflated count.
Tests should cover deleted, excluded, unsupported, oversized, resumed/reused, completed, failed, and mixed-file ranges.
Logs / error output
There is no explicit error. The observable mismatch is:
- preview selected: 63
- final files_reviewed: 68
Run and artifact source:
Additional context
The immutable manifest proposal in #367 is adjacent and should define the richer final vocabulary, but this is a released aggregate-count bug that should not remain hidden until that larger feature ships.
Related:
- Emit a complete immutable review manifest and partial-coverage contract #367
- PR feat(session): versioned run manifest + partial-coverage contract #379
- Global budget/usage accounting: 大 MR 场景下 open-code-review 可能在超时前产生极高 token 成本 #409
- Integration analysis: Make OCR synchronize reviews checkpointed, observable, and high-signal vybestack/llxprt-code#2649
Activity