Skip to content

Expose grouping strategy / per-file grouping for large change sets #2113

Backlog

Description

@cc7gs

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|llm or --max-files-per-group N.
  • GroupingPerFile already 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 --resume can 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

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

  1. added
    enhancement
    on Nov 26, 2026
  2. added theissue type on Nov 26, 2026
  3. cc7gs commented on Nov 27, 2026

    @cc7gs
    Author

    Additional request after testing a faster model in the same review pipeline:

    1. Please document whether ocr review retries 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.
    2. Please expose a provider-level rate-limit setting (for example max_requests_per_minute) or document the recommended 429 policy. Callers should not need to build a token bucket in the provider relay.
    3. Please clarify the billing scope of --timeout: plan/filter/grouping calls, 429 backoff, effort rounds, relocation and retries. At cutoff, how are in-flight groups versus queued groups recorded?
    4. If possible, include a budget receipt in JSON: task timeout, actual retry wait, completed requests per group, and truncated groups/files.

    These are interface semantics and documentation requests; no private code, repository identifiers, or business data are included.

  4. cc7gs commented on Nov 27, 2026

    @cc7gs
    Author

    One more controlled result on --timeout semantics:

    • Same 35-file change, same model (GLM-5.3, medium effort), same execution options (taskTimeoutMinutes: 28), same repository range.
    • OCR 1.14.3: 35/35 files complete, 46.9 min wall clock.
    • OCR 1.14.4: 17/35 files complete, partial, ~33 min; 18 files failed at the 28-minute setting.
    • A faster model on 1.14.4 also truncates with 28 minutes.

    This looks like a change in what --timeout covers (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.

  5. cc7gs commented on Nov 27, 2026

    @cc7gs
    Author

    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

    1. Does ocr review retry 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.
    2. Please expose a provider-level rate setting (for example max_requests_per_minute), or document the recommended 429 handling so callers do not rebuild token buckets outside the engine.

    --timeout billing

    1. The help text describes --timeout as 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.
    2. A verifiable budget receipt in the JSON result would remove the need to reverse-engineer journals: task timeout, actual retry wait, per-group completed request counts, truncated groups/files.

    Gateway error codes

    1. Our LLM gateway sometimes reports transient overload as HTTP 200 with a non-zero {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.
  6. cc7gs commented on Nov 27, 2026

    @cc7gs
    Author

    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

    1. Does ocr review retry 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.
    2. Please expose a provider-level rate setting (for example max_requests_per_minute), or document the recommended 429 handling so callers do not rebuild token buckets outside the engine.

    --timeout billing

    1. The help text describes --timeout as 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.
    2. A verifiable budget receipt in the JSON result would remove the need to reverse-engineer journals: task timeout, actual retry wait, per-group completed request counts, truncated groups/files.

    Gateway error codes

    1. Our LLM gateway sometimes reports transient overload as HTTP 200 with a non-zero {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.
  7. cc7gs commented on Nov 27, 2026

    @cc7gs
    Author

    --grouping per-file from #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.

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

    enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions