fix(gemini): place longest model prefix first in context_windows table (fix #7129) - #7146
fix(gemini): place longest model prefix first in context_windows table (fix #7129)#7146Jaymr1031-Z wants to merge 3 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthroughThe Gemini provider now selects context windows by longest model-name prefix. Synchronous and asynchronous calls now handle hook-blocking exceptions by emitting call-denied events and re-raising them. Tests cover distinct limits for Gemini thinking and standard Flash models. ChangesGemini completion behavior
Sequence Diagram(s)sequenceDiagram
participant Caller
participant GeminiCompletion
participant BeforeCallHook
participant CallDeniedEvent
Caller->>GeminiCompletion: call or acall with formatted messages
GeminiCompletion->>BeforeCallHook: invoke before-LLM-call hook
BeforeCallHook-->>GeminiCompletion: raise HookAborted or LLMCallBlockedError
GeminiCompletion->>CallDeniedEvent: emit call-denied event
GeminiCompletion-->>Caller: re-raise blocking exception
Suggested reviewers: Merge Risk: ⚪ Minimal · up to The PR fixes Gemini model context-window selection by prioritizing the most specific model prefix and adds regression coverage. No actionable merge-blocking risk remains beyond normal checks and review. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Linked Issues checkExplanation The changes satisfy issue Full details: Out of Scope Changes checkExplanation The Gemini context-window changes are in scope, but the updates to call and acall change before-LLM-call hook error handling by catching HookAborted and LLMCallBlockedError, emitting a call-denied event, and re-raising the exception. These changes are not covered by issue
✨ Finishing Touches🧪 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 |
…emini-thinking-context-window
Fixes #7129
Problem
In GeminiCompletion.get_context_window_size(), context_windows had gemini-2.0-flash listed before gemini-2.0-flash-thinking. Since the loop breaks and returns on the first prefix match, gemini-2.0-flash-thinking was unreachable dead code, causing it to return 891289 instead of 27852.
Solution