fix: issue #400 header-style selection for gemini-cli#404
fix: issue #400 header-style selection for gemini-cli#404ndycode wants to merge 2 commits intoNoeFabris:mainfrom
Conversation
WalkthroughThe request handler now computes a single Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. No actionable comments were generated in the recent review. 🎉 📜 Recent review detailsConfiguration used: Repository UI Review profile: CHILL Plan: Pro Cache: Disabled due to data retention organization setting Knowledge base: Disabled due to data retention organization setting 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
✏️ Tip: You can disable this entire section by setting 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 |
Greptile OverviewGreptile SummaryThis PR improves header-style-aware account selection for Gemini models by computing However, there's a critical bug at The account management and testing changes are solid and well-implemented - the issue is solely in the Confidence Score: 2/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant Plugin
participant getHeaderStyleFromUrl
participant AccountManager
participant Account
User->>Plugin: Request with Gemini model
loop Account Selection Loop
Plugin->>getHeaderStyleFromUrl: Get header style from URL
Note right of getHeaderStyleFromUrl: Line 2750 BUG:<br/>Converts gemini-cli to antigravity
getHeaderStyleFromUrl-->>Plugin: Returns "antigravity"
Plugin->>AccountManager: getCurrentOrNextForFamily(family, model, strategy, "antigravity")
AccountManager->>Account: Check rate limits for "antigravity"
alt Antigravity available
Account-->>AccountManager: Account available
AccountManager-->>Plugin: Return account
Plugin->>User: Make request with account
else Antigravity exhausted
Account-->>AccountManager: Rate limited for "antigravity"
AccountManager-->>Plugin: Switch account or apply fallback
alt Quota fallback enabled
Plugin->>Plugin: Change headerStyle to "gemini-cli"
Note right of Plugin: Fallback logic works within<br/>inner loop, but reselection<br/>still uses "antigravity"
else No fallback
Plugin->>Plugin: Switch to next account
Note right of Plugin: Loop continues with<br/>"antigravity" for next account
end
end
end
|
Additional Comments (1)
After introducing Prompt To Fix With AIThis is a comment left during a code review.
Path: src/plugin.ts
Line: 1140:1146
Comment:
**Stale headerStyle computation**
After introducing `requestedHeaderStyle`, this code still recomputes `headerStyle` via `getHeaderStyleFromUrl(urlString, family)` instead of using the already-derived value. If these diverge (e.g., if `urlString` changes due to endpoint fallback/transformations, or `getHeaderStyleFromUrl` depends on mutable state), the selection and request header style can get out of sync. Using the cached `requestedHeaderStyle` keeps behavior consistent with the chosen account/quota.
```suggestion
let headerStyle = requestedHeaderStyle;
```
How can I resolve this? If you propose a fix, please make it concise. |
50ed5cb to
16515be
Compare
Additional Comments (1)
Prompt To Fix With AIThis is a comment left during a code review.
Path: src/plugin.ts
Line: 2750:2750
Comment:
This ternary logic is backwards - when `quotaPreference` is `"gemini-cli"`, it returns `"antigravity"` instead. This defeats the purpose of the fix since `getHeaderStyleFromUrl` will always return `"antigravity"` for Gemini models, even when `cli_first: true` would make `resolveModelWithTier` prefer gemini-cli.
```suggestion
return quotaPreference ?? "antigravity";
```
How can I resolve this? If you propose a fix, please make it concise. |
Fixed issue #400.
The bug was in account selection: requests were being treated like antigravity too early, so gemini-cli could get blocked when Antigravity quota was exhausted.
What changed:
Verified with:
Closes #400