fix(gemini-sdk): treat "auto"/empty model as engine default - #304
Open
yodakrkids wants to merge 1 commit into
Open
fix(gemini-sdk): treat "auto"/empty model as engine default#304yodakrkids wants to merge 1 commit into
yodakrkids wants to merge 1 commit into
Conversation
The SDK path (gemini_sdk::stream_run) used `input.model.as_deref().unwrap_or("gemini-2.5-flash")`,
which forwards "auto" verbatim into `models/auto:streamGenerateContent` and
gets a 404 NOT_FOUND from Google.
The CLI path (agents/gemini.rs:38-43) already has this guard: when
`model == "auto"` it skips `--model` and lets the gemini CLI pick its
default. The SDK path was missing it, so any caller that relied on
GEMINI_API_KEY → SDK routing broke as soon as a participant ran with
`model: "auto"` (RT default).
Mirror the CLI special-case in the SDK so both paths handle "auto" and
empty string the same way.
Repro: set `GEMINI_API_KEY`, add an RT participant with engine=gemini
and model=auto, run a round → 404. After fix → falls back to
`gemini-2.5-flash` and succeeds.
Verified: cargo check clean.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
There was a problem hiding this comment.
Code Review
This pull request updates src-tauri/src/agents/gemini_sdk.rs to filter out empty strings and 'auto' values from the model input, defaulting to 'gemini-2.5-flash' to prevent 404 errors from the Gemini API. There are no review comments, so I have no feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
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.
The SDK path (gemini_sdk::stream_run) used
input.model.as_deref().unwrap_or("gemini-2.5-flash"), which forwards "auto" verbatim intomodels/auto:streamGenerateContentand gets a 404 NOT_FOUND from Google.The CLI path (agents/gemini.rs:38-43) already has this guard: when
model == "auto"it skips--modeland lets the gemini CLI pick its default. The SDK path was missing it, so any caller that relied on GEMINI_API_KEY → SDK routing broke as soon as a participant ran withmodel: "auto"(RT default).Mirror the CLI special-case in the SDK so both paths handle "auto" and empty string the same way.
Repro: set
GEMINI_API_KEY, add an RT participant with engine=gemini and model=auto, run a round → 404. After fix → falls back togemini-2.5-flashand succeeds.Verified: cargo check clean.
Summary
Related plan / issue
Changes
Test plan
npx tsc --noEmitnpx vite buildcd src-tauri && cargo checknpx vitest runcd src-tauri && cargo test --libInvariants touched
Screenshots / logs
Checklist
feat(scope): ...)