Description
Problem Statement
On large change sets, wall-clock time is capped by the number of review groups, not by --concurrency. --concurrency parallelizes groups, but the grouping step collapses many files into a few semantic groups.
Aggregated measurements from private repositories (no code, repository names, or patches included):
| Changed files | Review groups | Concurrency | Wall clock |
|---|---|---|---|
| 35 | 7 | 16 | ~47 min |
| 26 | 6 | 12 | ~27 min |
| 2 | 1 | 8 | ~9.5 min |
The 35-file case did not improve linearly when concurrency rose from 8 to 16; the longest group dominates. A 2-file change with one group is model-bound and cannot use backend concurrency at all.
Proposed Solution
Expose the grouping strategy that already exists in internal/config/template/template.go:
- Add a CLI/config override, for example
--grouping per-file|bundle-all|llmor--max-files-per-group N. GroupingPerFilealready exists but has no runtime override. Forcing it on large change sets would let more groups run in parallel.- Include
groups[]in the JSON result:groupId,files,state,completedFiles,missingFiles,failureCode; keep the existing coverage fields compatible. - If feasible, surface group/wave checkpoints and make the session id discoverable after a timeout or kill so
--resumecan reuse completed files. Today a killed process leaves no report to resume from.
A flag with the current behavior as the default would keep existing users unaffected.
Alternatives Considered
--effort lowhalves time but loses recall in our checks.- Intra-group parallelism (Use backend concurrency within a review group: parallel rounds, or split large single-file diffs #1681) helps single large files and review rounds, but does not address too few groups across many files.
- Splitting the change set into multiple OCR runs works, but loses cross-file context and requires external merging of coverage and findings.
Affected Area
Review Agent / LLM interaction
Additional Context
Related: #1681 (intra-group parallel rounds), #1813 (15-30 min wall clock), #409 (large-MR cost/scale guards).
Current main still has GroupingViaLLM, GroupingBundleAll, and GroupingPerFile, but no CLI or config override. The measurements above are aggregated from private runs; no private code, repository identifiers, internal links, or business data are included.
Activity
cc7gs commentedon Nov 27, 2026
Additional request after testing a faster model in the same review pipeline:
ocr reviewretries HTTP 429, and whether retry backoff counts toward--timeout. In one integration, a single[RPM LIMIT]permanently failed a review group; the retry budget did not cover the rate-limit window.max_requests_per_minute) or document the recommended 429 policy. Callers should not need to build a token bucket in the provider relay.--timeout: plan/filter/grouping calls, 429 backoff, effort rounds, relocation and retries. At cutoff, how are in-flight groups versus queued groups recorded?These are interface semantics and documentation requests; no private code, repository identifiers, or business data are included.
cc7gs commentedon Nov 27, 2026
One more controlled result on
--timeoutsemantics:taskTimeoutMinutes: 28), same repository range.This looks like a change in what
--timeoutcovers (whole task versus per-file/per-round) rather than a model throughput issue. Please confirm the intended 1.14.4 semantics and whether 1.14.3's 28-minute behavior can be preserved. The numbers are aggregated from private runs; no code, repository names, or patches are included.cc7gs commentedon Nov 27, 2026
Follow-up from the measurements above, after running more large-change-set reviews through a caller-side runtime (aggregated numbers only, no private code):
429 / rate limiting
ocr reviewretry HTTP 429 internally, and are those retries constrained by--timeout? When the provider gateway enforces an RPM limit, callers need to know whether a single[RPM LIMIT]reply permanently fails the whole group, and whether backoff wait counts against the task budget.max_requests_per_minute), or document the recommended 429 handling so callers do not rebuild token buckets outside the engine.--timeoutbilling--timeoutas a concurrent-task budget covering "LLM requests and retries", multiplied by effort rounds. Please document the exact billing scope: plan/filter/grouping calls, 429 backoff, re-location and retries, and how in-flight files and unstarted groups are recorded at the cutoff.Gateway error codes
{code}body. We observed 401/403 (auth) and code 112 (model not configured) as deterministic and mapped everything else to a bounded retry window. A documented set of deterministic gateway codes would avoid slow failures on unknown codes - without it, callers must treat unknown codes as transient and burn their full bounded retry window on errors that retry cannot fix.cc7gs commentedon Nov 27, 2026
Follow-up from the measurements above, after running more large-change-set reviews through a caller-side runtime (aggregated numbers only, no private code):
429 / rate limiting
ocr reviewretry HTTP 429 internally, and are those retries constrained by--timeout? When the provider gateway enforces an RPM limit, callers need to know whether a single[RPM LIMIT]reply permanently fails the whole group, and whether backoff wait counts against the task budget.max_requests_per_minute), or document the recommended 429 handling so callers do not rebuild token buckets outside the engine.--timeoutbilling--timeoutas a concurrent-task budget covering "LLM requests and retries", multiplied by effort rounds. Please document the exact billing scope: plan/filter/grouping calls, 429 backoff, re-location and retries, and how in-flight files and unstarted groups are recorded at the cutoff.Gateway error codes
{code}body. We observed 401/403 (auth) and code 112 (model not configured) as deterministic and mapped everything else to a bounded retry window. A documented set of deterministic gateway codes would avoid slow failures on unknown codes - without it, callers must treat unknown codes as transient and burn their full bounded retry window on errors that retry cannot fix.cc7gs commentedon Nov 27, 2026
--grouping per-filefrom #2117 covers the grouping part of this request for us — thanks for picking it up so quickly.We've split the remaining asks out so this issue can close cleanly when #2117 merges:
Happy to provide aggregated measurements for any of them.