Repository navigation
Stop sending the "auto" model sentinel to the Gemini API - #117
Merged
Merged
Conversation
AI error: 404 NOT_FOUND. models/auto is not found for API version v1beta,
or is not supported for generateContent.
"auto" is the UI sentinel for "pick the best free model" — the first and default
entry in the model dropdown. models.resolve() exists precisely to turn it into a
real id. Two call sites skipped it:
mdl = model if model and "claude" not in model.lower() else "gemini-3.1-flash-lite"
"auto" is truthy and contains no "claude", so it fell through the conditional
untouched and went to the API as a model name. Anyone who never changed the model
picker hit this.
ai_detect._ask_model and ember_browser's AI helper now route through
models.resolve(), which preserves the original intent — a Claude id means "use
the Gemini default here" — and additionally picks up retired-model remapping,
which those two paths never had.
Tests cover the resolver, both call sites, and a driven call through
ai_detect._ask_model with a stubbed client asserting what would have gone over the
wire. Plus a sweep over every module: any model= argument to generate_content must
be a literal or resolved, so the next call site that forgets is caught by the suite
rather than by a user.
Full suite 1379 passed, same 23 pre-existing environment failures.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WebHeGmZb12sW6ZUuyUNix
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.
Cause
autois the UI sentinel for "pick the best free model" — the first and default entry in the model dropdown.models.resolve()exists precisely to turn it into a real id. Two call sites skipped it:"auto"is truthy and contains no"claude", so it fell through the conditional untouched and went to the API as a model name. Anyone who never changed the model picker hit this.Fix
ai_detect._ask_modelandember_browser's AI helper now route throughmodels.resolve(), which:Testing
Covers the resolver, both call sites, and a driven call through
ai_detect._ask_modelwith a stubbed client asserting what would actually have gone over the wire.Plus a sweep over every module: any
model=argument togenerate_contentmust be a literal or explicitly resolved. The next call site that forgets gets caught by the suite rather than by a user — which is how both of these should have been caught.One test also guards the premise: if the dropdown ever stops offering
auto, the rest of the file would be theatre, so it asserts the sentinel is still there and still first.1379 passed, same 23 pre-existing environment failures.
Generated by Claude Code