Skip to content

fix: Gemini context limit (#86) + surface silent API failures#87

Merged
bobmatnyc merged 2 commits intomainfrom
fix/issue-86-and-silent-review-failures
Feb 22, 2026
Merged

fix: Gemini context limit (#86) + surface silent API failures#87
bobmatnyc merged 2 commits intomainfrom
fix/issue-86-and-silent-review-failures

Conversation

@bobmatnyc
Copy link
Copy Markdown
Owner

Summary

  • Fix [Bug]: context limit for Gemini incorrectly reported #86: Add "google" provider alias so google:model-name gets correct 1M+ token context limit instead of 100K fallback
  • Fix silent API failures: When all multi-pass review API calls fail, surface clear error report instead of empty findings

Changes

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.

  • Added google alias in DEFAULT_CONTEXT_WINDOWS, DEFAULT_OUTPUT_LIMITS, and apiKeyEnvVarMap
  • Added regression test

2. 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.

  • Added comprehensive case to getMaxTokensForReviewType() (was falling to default 8000)
  • Detect when ALL passes fail → return clear "Review Failed" report with per-pass errors
  • Log HTTP status/error at warn level (visible without --debug)
  • Detect error-only content in fallback consolidation → structured failure report
  • Cleaned up 2 pre-existing lint issues (_jsonContent unused var, unused loop index)

Test plan

  • All 564 tests pass
  • ESLint passes (pre-commit hooks green)
  • TypeScript type check passes
  • Verified google:gemini-3.1-pro-preview → 1,048,576 tokens
  • Verified google:gemini-2.5-pro → 1,048,576 tokens

🤖 Generated with Claude Code

bobmatnyc and others added 2 commits February 22, 2026 12:51
**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>
@bobmatnyc bobmatnyc merged commit 317ba6d into main Feb 22, 2026
4 of 5 checks passed
@bobmatnyc bobmatnyc deleted the fix/issue-86-and-silent-review-failures branch February 22, 2026 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: context limit for Gemini incorrectly reported

1 participant