Skip to content

review: --max-tools 10-29 is accepted but silently ignored #935

Description

@vincekent

Problem

In current main and v1.9.4, ocr review --max-tools N accepts and normalizes positive values down to a documented minimum of 10, but values from 10 through 29 do not affect the embedded review template whose default is 30.

The two code paths disagree:

  • validateReviewOptions clamps 1..9 to 10, and the review flag help says max tool call rounds per file (0 = template default; min 10).
  • loadCommonContext applies the value only when maxTools > tpl.MaxToolRequestTimes.

Therefore, --max-tools 10, 15, and 20 all still run with 30 rounds. There is no warning that the supplied cap was ignored.

This matches the historical behavior documented in #20, but it conflicts with the current review CLI contract and prevents operators from using the flag as a cost/latency guard.

Why it matters

Review cost can be dominated by accumulated per-file tool rounds rather than diff size. A small ambiguous file that consumes the full 30-round conversation can cost more than many straightforward files. A positive value described as a maximum must either lower the effective round limit or fail clearly; silently retaining 30 makes cost controls appear active when they are not.

Proposed contract

For ocr review:

  • --max-tools 0: use the embedded template default.
  • --max-tools N where N >= 10: set the effective per-file maximum to exactly N.
  • 1..9: keep the existing clamp-to-10 behavior, or reject it explicitly.
  • Negative values: keep rejecting them.

If scan intentionally needs raise-only behavior, it can retain that separately with its existing explicit help text.

Acceptance test

With an embedded template value of 30, prove the resolved review template is:

  • 30 when CLI value is 0
  • 10 when CLI value is 10
  • 20 when CLI value is 20
  • 40 when CLI value is 40

The effective value should also be visible in JSON/session diagnostics so callers can prove which cap actually ran.

Activity

  1. patmmccann commented on Oct 30, 2026

    @patmmccann

    A concrete use case for honoring lower --max-tools values: Prebid.js runs ocr review in GitHub Actions against a local, CPU-only model (Ollama, Qwen3.5 9B on ubuntu-latest, no external API). There, the round count is the cost and latency. Each round takes about 2–4 minutes, because prefill runs at ~35 tok/s and generation at ~3.4 tok/s. A 3-line diff took 6m16s across 4 requests (run).

    Two things would help:

    1. Make the value a cap, as fix(review): honor lower max-tools overrides #1118 and fix(review): make --max-tools a cap instead of a floor #1687 both do. Today any value up to 100 is accepted and ignored, so a cost guard looks active when it isn't. Our workflow currently carries a comment saying --max-tools can't lower the budget.
    2. Reconsider the minimum of 50 for review. Both PRs keep that clamp. At ~3 minutes a round, 50 rounds is still about 2.5 hours per group. For small or local models, an operator-chosen cap of 10–20 is the realistic range. Very low values could still log a warning.

    If raise-only is intentional (as described in #20), a clear warning when a lower value is ignored would at least stop the flag from looking like it works.

    — wording in collaboration with Claude

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions