fix(models): add gemini-3.1-pro-preview forward-compat for google-gemini-cli provider#21181
Conversation
…ini-cli Clone gemini-3-pro-preview as forward-compat until pi-ai's model catalog is updated upstream. Closes openclaw#21176
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
nikolasdehor
left a comment
There was a problem hiding this comment.
LGTM. I use google-gemini-cli/gemini-3-flash-preview as a fallback provider and forward-compat for new Gemini models is directly relevant to my setup.
The implementation follows the exact same pattern as the existing forward-compat resolvers for claude-opus-4-6, glm-5, and gemini-3-pro-image:
- Constants for the new model ID and template model IDs
- A resolver function scoped to the correct provider (
google-gemini-cli) - Normalization of provider ID and model ID before comparison
cloneFirstTemplateModelusinggemini-3-pro-previewas the template- Wired into the
resolveForwardCompatModelchain at the end
A couple of minor observations (non-blocking):
-
The resolver only handles
gemini-3.1-pro-preview. If Google follows their usual naming pattern,gemini-3.1-flash-previewwill likely land soon too. Might be worth preemptively adding a flash variant, or making the resolver more generic (e.g., matchinggemini-3.1-*-previewand cloning from the correspondinggemini-3-*-previewtemplate). But that's a separate PR. -
No test file changes in this diff. I see the existing forward-compat resolvers have test coverage in the codebase — it would be good to add a test case for this one to match. Again, non-blocking for the fix itself.
Clean change, minimal surface area, no behavioral impact on other providers or models. Good to ship.
|
Any timeline for merging this? We've been trying to use |
|
I'm testing this PR, but I'm getting this error: Maybe my account don't have access yet? I'm a Pro user. |
API Investigation ResultsAfter extensive testing, I've identified the actual root cause — it's not a forward-compat resolver issue (that code is correct), it's a Google Cloud Code Assist API-side problem. Direct API TestingI tested against
Account TierThe account is The Interesting PartThe standalone ConclusionThis PR's forward-compat code is correct and should be merged. But Is there any known way to get a token that has access to |
Why do you assume most users are using the subscription and OAuth? API use should work fine which is probably more users than you think (i.e. myself). |
|
@proteanx — that's a fair and important correction, thank you. You're right that the framing in the investigation conflated two separate failure modes: Failure Mode A — What this PR fixes (affects all users): Failure Mode B — Separate from this PR (OAuth/subscription tier only): So to directly answer @ericsr and @ChiaraRvtk: if you're hitting 404 after applying this PR, that's the cloudcode-pa rollout issue, not a bug here. API key users who try This PR's scope is and always was only the catalog fix — the forward-compat resolver. The implementation is correct and isolated. Happy to update the PR description to make the two failure modes clearer if that helps reviewers. |
|
Wild, you responded within like 50 seconds. Now we're using AI to write PR comments 😅 |
|
Confirmed working workaround on macOS with
Result from local validation:
I documented reproducible steps here: If useful, maintainers can either merge the provider catalog update or keep this as temporary workaround in docs. |
|
Follow-up: please also watch the adaptation details, not only adding one model id. From real integration testing, these are the common breakpoints:
This helps prevent the “looks added in config but still fails in runtime” class of bugs. |
|
Hey there! Thanks for adding support for Gemini 3.1. Would it be possible to also add the According to the official Google documentation, this specific variant is explicitly optimized for agentic workflows that rely on bash and custom tools, which makes it particularly relevant for OpenClaw's architecture. It would be amazing to have native support for this endpoint out of the box! Thanks for your hard work on this. |
|
I successfully added google-gemini-cli/gemini-3.1-pro-preview as my default model with oauth by: |
|
Thanks for opening this and for the forward-compat work. Closing in favor of #26570 as the canonical PR for the same google-gemini-cli Gemini 3.1 fallback path. |
Summary
gemini-3.1-pro-previewlaunched 2026-02-19 and works via the standalone Gemini CLI (gemini -m gemini-3.1-pro-preview), but OpenClaw rejects it withUnknown model: google-gemini-cli/gemini-3.1-pro-previewbecause pi-ai's built-in model catalog doesn't include it yet.google-gemini-clicannot use the new model until the catalog is updated.resolveGeminiCli31ProPreviewForwardCompatModelforward-compat resolver insrc/agents/model-forward-compat.tsthat clonesgemini-3-pro-previewasgemini-3.1-pro-preview— the same pattern used forclaude-opus-4-6,glm-5, andgemini-3-pro-imagein the existing codebase.Change Type (select all)
Scope (select all touched areas)
User-visible / Behavior Changes
google-gemini-cli/gemini-3.1-pro-previewnow resolves to a clonedgemini-3-pro-previewmodel definition, unblocking users who upgraded the Gemini CLI and set the new model in their config.Security Impact (required)
Repro + Verification
google-gemini-cli/gemini-3.1-pro-previewUnknown model: google-gemini-cli/gemini-3.1-pro-previewgemini-3-pro-previewmetadata as templateCompatibility / Migration
Closes
Closes #21176
🤖 AI-Assisted: Yes (via OpenClaw)
Greptile Summary
Adds forward-compatibility support for
gemini-3.1-pro-previewmodel in thegoogle-gemini-cliprovider. The model launched on 2026-02-19 and works via the standalone Gemini CLI but isn't yet in pi-ai's built-in catalog. The implementation clonesgemini-3-pro-previewas a template using the same pattern established for other forward-compat models (claude-opus-4-6,glm-5). The change is minimal, isolated, and follows existing architectural patterns correctly.Confidence Score: 5/5
google-gemini-cli/gemini-3.1-pro-previewmodel combination. The template model (gemini-3-pro-preview) exists and is referenced throughout the codebase. No behavioral changes for other models or providers.Last reviewed commit: d54bce3