Repository navigation
fix(google): clamp max output tokens per model, without inventing a ceiling for unknown ids (rebase of #2512) - #2576
Conversation
The clamp matched by substring and fell back to 16,384 for anything unmatched, so an alias, a gateway id, or any model newer than the table was silently truncated to 16,384 regardless of what the operator asked for. structure/02_config-and-codex-home.md is explicit that an explicit request value wins. Unknown ids now return undefined and pass the request through untouched; the upstream stays the authority on its own limit. Matching is also prefix/family based, because includes(pro) matched my-prototype-model and includes(oss) matched crossover-v2.
|
✅ Deterministic PR hygiene checks passed. |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughGoogle model output-token requests now apply documented ceilings for supported model families. Unknown models preserve valid requested values. Invalid or non-positive values remain omitted. Tests cover model matching, clamping, passthrough, and invalid inputs. ChangesGoogle output token clamping
Estimated code review effort: 3 (Moderate) | ~20 minutes Suggested reviewers: ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c6d8edf6fb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // Pro tops out one token below the flash/other Gemini ceiling; both are documented values. | ||
| return /(^|[-.])pro([-.]|$)/.test(lower) ? 65535 : 65536; | ||
| } | ||
| if (lower.startsWith("claude")) return 64000; |
There was a problem hiding this comment.
Preserve per-model Claude output ceilings
When Google Antigravity live discovery selects claude-sonnet-4-6-thinking, the repository metadata at scripts/model-metadata.source.json:12511-12529 records a 128,000-token output limit, but this family-wide branch makes clampGoogleMaxOutputTokens(..., 100000) return 64,000. Before this change the requested 100,000 tokens reached upstream; now it is silently truncated, so read exact ceilings from the canonical provider metadata and pass through unmatched Claude IDs rather than treating every Claude model as 64,000.
AGENTS.md reference: src/AGENTS.md:L18-L18
Useful? React with 👍 / 👎.
…eiling for unknown ids (rebase of lidge-jun#2512) (lidge-jun#2576) * fix(google): clamp max output tokens per model * fix(google): clamp max output tokens per model * fix(google): do not invent an output ceiling for unrecognized models The clamp matched by substring and fell back to 16,384 for anything unmatched, so an alias, a gateway id, or any model newer than the table was silently truncated to 16,384 regardless of what the operator asked for. structure/02_config-and-codex-home.md is explicit that an explicit request value wins. Unknown ids now return undefined and pass the request through untouched; the upstream stays the authority on its own limit. Matching is also prefix/family based, because includes(pro) matched my-prototype-model and includes(oss) matched crossover-v2. --------- Co-authored-by: Hsia97 <xjxj1997@163.com>
…eiling for unknown ids (rebase of lidge-jun#2512) (lidge-jun#2576) * fix(google): clamp max output tokens per model * fix(google): clamp max output tokens per model * fix(google): do not invent an output ceiling for unrecognized models The clamp matched by substring and fell back to 16,384 for anything unmatched, so an alias, a gateway id, or any model newer than the table was silently truncated to 16,384 regardless of what the operator asked for. structure/02_config-and-codex-home.md is explicit that an explicit request value wins. Unknown ids now return undefined and pass the request through untouched; the upstream stays the authority on its own limit. Matching is also prefix/family based, because includes(pro) matched my-prototype-model and includes(oss) matched crossover-v2. --------- Co-authored-by: Hsia97 <xjxj1997@163.com>
Summary
Rebase of #2512 (by @Hsia97) onto current
dev, with the review finding fixed.The original change clamps Google-surface output tokens per model. The review objected to
two things, both real:
an alias, a gateway-prefixed id, or any model newer than the table was silently
truncated no matter what the operator requested.
structure/02_config-and-codex-home.mdis explicit that an explicit request value wins. Unknown ids now return
undefinedandthe request passes through untouched — the upstream stays the authority on its own limit.
includes("pro")matchedmy-prototype-modelandincludes("oss")matchedcrossover-v2. Matching is now prefix/family based.The original test asserted the 16,384 fallback, which locked the defect in; it is replaced
with assertions for the passthrough contract and for the substring cases.
Closes #2512.
Verification
clampGoogleMaxOutputTokenshas a single call site (src/adapters/google.ts:690), whichis unaffected by the widened return type.
Checklist
devdevhead (2/2, no conflicts)Summary by CodeRabbit