You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
review: --max-tools 10-29 is accepted but silently ignored #935
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.
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).
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.
Activity
patmmccann commentedon Oct 30, 2026
A concrete use case for honoring lower
--max-toolsvalues: Prebid.js runsocr reviewin GitHub Actions against a local, CPU-only model (Ollama, Qwen3.5 9B onubuntu-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:
--max-toolscan't lower the budget.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
Merge origin/main into fix/935-max-tools-cap-ignored