fix: Gemini context limit (#86) + surface silent API failures#87
Merged
fix: Gemini context limit (#86) + surface silent API failures#87
Conversation
**Issue**: When users specify models with "google:" prefix (e.g. "google:gemini-3.1-pro-preview"), the system incorrectly reports context limit as 100,000 instead of 1,048,576 tokens. **Root Cause**: DEFAULT_CONTEXT_WINDOWS map only had "gemini" but not "google" as provider alias. When unknown models are encountered, the fallback logic uses provider defaults, but since "google" wasn't mapped, it fell back to the hardcoded 100,000 token limit. **Changes**: - Add "google" as alias in DEFAULT_CONTEXT_WINDOWS (1,048,576 tokens) - Add "google" as alias in DEFAULT_OUTPUT_LIMITS (8,192 tokens) - Add "google" as alias in apiKeyEnvVar mapping (AI_CODE_REVIEW_GOOGLE_API_KEY) - Add test case to prevent regression **Verification**: ✅ google:gemini-3.1-pro-preview → 1,048,576 tokens (was 100,000) ✅ google:gemini-2.5-pro → 1,048,576 tokens (was 100,000) ✅ All existing tests pass ✅ Backwards compatible - no breaking changes Fixes #86 Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com>
…port When all multi-pass API calls fail, the tool was producing a normal-looking report with 0 tokens and empty findings. Users had no indication anything went wrong without --debug flag. Root cause: cascade of 3 silent failures: 1. API pass failures produce hardcoded 0-token fallback results 2. Fallback consolidation regex finds nothing in error content 3. HTTP errors only logged at debug level Changes: - Add 'comprehensive' case to getMaxTokensForReviewType() (was falling to default 8000 which may cause failures with large prompts) - Detect when ALL passes fail and return clear "Review Failed" report with per-pass error details and actionable guidance - Log HTTP status/error at warn level (visible without --debug) - Detect error-only content in fallback consolidation and generate structured failure report instead of empty findings - Remove unused _jsonContent variable (pre-existing lint issue) - Fix unused loop variable in consolidation error mapping Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This was referenced Feb 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
google:model-namegets correct 1M+ token context limit instead of 100K fallbackChanges
1. Gemini context limit fix (Fixes #86)
When users specify models with
google:prefix (e.g.google:gemini-3.1-pro-preview), the fallback system now correctly uses Gemini's 1,048,576 token context window instead of the 100,000 default.googlealias inDEFAULT_CONTEXT_WINDOWS,DEFAULT_OUTPUT_LIMITS, andapiKeyEnvVarMap2. Silent API failure fix
When all comprehensive review passes fail, the tool was producing a normal-looking report with 0 tokens and empty findings — no indication of failure without
--debug.comprehensivecase togetMaxTokensForReviewType()(was falling to default 8000)warnlevel (visible without--debug)_jsonContentunused var, unused loop index)Test plan
google:gemini-3.1-pro-preview→ 1,048,576 tokensgoogle:gemini-2.5-pro→ 1,048,576 tokens🤖 Generated with Claude Code