Skip to content

fix(gemini-sdk): treat "auto"/empty model as engine default - #304

Open
yodakrkids wants to merge 1 commit into
hang-in:mainfrom
yodakrkids:fix/gemini-sdk-auto-model
Open

fix(gemini-sdk): treat "auto"/empty model as engine default#304
yodakrkids wants to merge 1 commit into
hang-in:mainfrom
yodakrkids:fix/gemini-sdk-auto-model

Conversation

@yodakrkids

Copy link
Copy Markdown
Contributor

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.

Summary

Related plan / issue

Changes

Test plan

  • npx tsc --noEmit
  • npx vite build
  • cd src-tauri && cargo check
  • npx vitest run
  • cd src-tauri && cargo test --lib
  • Manual smoke test of the affected feature

Invariants touched

Screenshots / logs

Checklist

  • PR title follows Conventional Commits (feat(scope): ...)
  • Tests added or updated
  • Docs updated (plan, README, how-to) if behavior changed
  • No secrets, tokens, or personal paths in the diff

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>

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

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.

1 participant