fix(google): resolve Gemini 3.1 models for all Google provider aliases#56567
fix(google): resolve Gemini 3.1 models for all Google provider aliases#56567hydro13 merged 1 commit intoopenclaw:mainfrom
Conversation
Greptile SummaryThis PR fixes
Confidence Score: 5/5Safe to merge; the fix is well-scoped and the two remaining findings are P2 style/coverage concerns that do not block correctness in production. All identified issues are P2: the flash-lite → flash fallback is a potential metadata inaccuracy without an immediate reproducer, and the google-gemini-cli comment gap is purely cosmetic. The primary regression (alias providers returning undefined for Gemini 3.1 models) is fixed and covered by new tests. No P0/P1 issues found. extensions/google/provider-models.ts — review GEMINI_3_1_FLASH_LITE_TEMPLATE_IDS fallback to "gemini-3-flash-preview"
|
| Filename | Overview |
|---|---|
| extensions/google/provider-models.ts | Adds flash-lite prefix/template handling and a new cloneFirstGoogleTemplateModel helper that iterates provider IDs (primary then fallback) for template resolution. Prefix ordering fix (flash-lite before flash) is correct. Minor concern: flash-lite falls back to a flash template when its own template is absent. |
| extensions/google/index.ts | Replaces hardcoded "google" with ctx.provider and adds templateProviderId fallback for the main google provider registration. Correctly resolves templates for hook aliases (google-vertex, google-antigravity). google-gemini-cli provider registration left unchanged (intentional). |
| extensions/google/provider-models.test.ts | New test file covering pro via google-vertex alias, flash via direct google provider, and flash-lite prefix ordering. Covers the primary regression scenarios. Missing coverage for: flash-lite falling back to flash template, and google-antigravity alias. |
Comments Outside Diff (1)
-
extensions/google/index.ts, line 141-142 (link)google-gemini-cliprovider missingtemplateProviderIdafter refactorThe
googleprovider registration was updated to passtemplateProviderId: GOOGLE_GEMINI_CLI_PROVIDER_IDso that alias providers can fall back togoogle-gemini-clitemplates. Thegoogle-gemini-cliprovider's ownresolveDynamicModelwas not touched and still callsresolveGoogle31ForwardCompatModelwithouttemplateProviderId.This is consistent with
google-gemini-clibeing a standalone provider (not an alias), and the current tests pass because its templates are registered under its own ID. However, ifgoogle-gemini-cliever needs a cross-provider template fallback in the future, no fallback mechanism exists here. A brief comment explaining this intentional omission would help future readers.Prompt To Fix With AI
This is a comment left during a code review. Path: extensions/google/index.ts Line: 141-142 Comment: **`google-gemini-cli` provider missing `templateProviderId` after refactor** The `google` provider registration was updated to pass `templateProviderId: GOOGLE_GEMINI_CLI_PROVIDER_ID` so that alias providers can fall back to `google-gemini-cli` templates. The `google-gemini-cli` provider's own `resolveDynamicModel` was not touched and still calls `resolveGoogle31ForwardCompatModel` without `templateProviderId`. This is consistent with `google-gemini-cli` being a standalone provider (not an alias), and the current tests pass because its templates are registered under its own ID. However, if `google-gemini-cli` ever needs a cross-provider template fallback in the future, no fallback mechanism exists here. A brief comment explaining this intentional omission would help future readers. How can I resolve this? If you propose a fix, please make it concise.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Prompt To Fix All With AI
This is a comment left during a code review.
Path: extensions/google/provider-models.ts
Line: 11-14
Comment:
**Flash-lite falls back to flash template metadata**
`GEMINI_3_1_FLASH_LITE_TEMPLATE_IDS` includes `"gemini-3-flash-preview"` as a fallback when `"gemini-3.1-flash-lite-preview"` isn't found in the registry. Flash and flash-lite have different capabilities (context window, pricing, token limits), so cloning flash metadata for a flash-lite model request would silently produce an incorrect model descriptor.
None of the new tests cover this fallback path (i.e. the case where only `"gemini-3-flash-preview"` is registered but `"gemini-3.1-flash-lite-preview"` is requested). Consider either:
1. Removing the `"gemini-3-flash-preview"` fallback from `GEMINI_3_1_FLASH_LITE_TEMPLATE_IDS` and returning `undefined` when the dedicated template is absent, or
2. Adding a test asserting the expected behaviour when the fallback is exercised, and documenting why borrowing flash properties for flash-lite is acceptable.
How can I resolve this? If you propose a fix, please make it concise.
---
This is a comment left during a code review.
Path: extensions/google/index.ts
Line: 141-142
Comment:
**`google-gemini-cli` provider missing `templateProviderId` after refactor**
The `google` provider registration was updated to pass `templateProviderId: GOOGLE_GEMINI_CLI_PROVIDER_ID` so that alias providers can fall back to `google-gemini-cli` templates. The `google-gemini-cli` provider's own `resolveDynamicModel` was not touched and still calls `resolveGoogle31ForwardCompatModel` without `templateProviderId`.
This is consistent with `google-gemini-cli` being a standalone provider (not an alias), and the current tests pass because its templates are registered under its own ID. However, if `google-gemini-cli` ever needs a cross-provider template fallback in the future, no fallback mechanism exists here. A brief comment explaining this intentional omission would help future readers.
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "fix(google): resolve Gemini 3.1 models f..." | Re-trigger Greptile
| const GEMINI_3_1_FLASH_LITE_TEMPLATE_IDS = [ | ||
| "gemini-3.1-flash-lite-preview", | ||
| "gemini-3-flash-preview", | ||
| ] as const; |
There was a problem hiding this comment.
Flash-lite falls back to flash template metadata
GEMINI_3_1_FLASH_LITE_TEMPLATE_IDS includes "gemini-3-flash-preview" as a fallback when "gemini-3.1-flash-lite-preview" isn't found in the registry. Flash and flash-lite have different capabilities (context window, pricing, token limits), so cloning flash metadata for a flash-lite model request would silently produce an incorrect model descriptor.
None of the new tests cover this fallback path (i.e. the case where only "gemini-3-flash-preview" is registered but "gemini-3.1-flash-lite-preview" is requested). Consider either:
- Removing the
"gemini-3-flash-preview"fallback fromGEMINI_3_1_FLASH_LITE_TEMPLATE_IDSand returningundefinedwhen the dedicated template is absent, or - Adding a test asserting the expected behaviour when the fallback is exercised, and documenting why borrowing flash properties for flash-lite is acceptable.
Prompt To Fix With AI
This is a comment left during a code review.
Path: extensions/google/provider-models.ts
Line: 11-14
Comment:
**Flash-lite falls back to flash template metadata**
`GEMINI_3_1_FLASH_LITE_TEMPLATE_IDS` includes `"gemini-3-flash-preview"` as a fallback when `"gemini-3.1-flash-lite-preview"` isn't found in the registry. Flash and flash-lite have different capabilities (context window, pricing, token limits), so cloning flash metadata for a flash-lite model request would silently produce an incorrect model descriptor.
None of the new tests cover this fallback path (i.e. the case where only `"gemini-3-flash-preview"` is registered but `"gemini-3.1-flash-lite-preview"` is requested). Consider either:
1. Removing the `"gemini-3-flash-preview"` fallback from `GEMINI_3_1_FLASH_LITE_TEMPLATE_IDS` and returning `undefined` when the dedicated template is absent, or
2. Adding a test asserting the expected behaviour when the fallback is exercised, and documenting why borrowing flash properties for flash-lite is acceptable.
How can I resolve this? If you propose a fix, please make it concise.There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 326a068cc0
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
The forward-compat resolver hardcoded 'google' as the provider ID for template lookup, so alias providers (google-vertex, google-gemini-cli) could not find matching templates. Pass the actual provider ID from the runtime context and add a templateProviderId fallback for cross-provider template resolution. Also fix flash-lite prefix ordering — check 'gemini-3.1-flash-lite' before 'gemini-3.1-flash' to prevent misclassification. Add regression tests for pro, flash, and flash-lite across provider aliases. Fixes openclaw#36111
326a068 to
689b9c7
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 689b9c7f53
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| patch: { | ||
| ...params.patch, | ||
| provider: params.providerId, | ||
| }, |
There was a problem hiding this comment.
Preserve transport fields when cloning cross-provider templates
When this helper clones from templateProviderId, it rewrites only provider and keeps the template api/baseUrl, so alias resolution can now return mixed models (fresh evidence: the new test asserts provider: "google-vertex" with api: "google-gemini-cli"). That breaks downstream assumptions keyed on provider ID (for example sanitizeToolsForGoogle only runs for google-gemini-cli), so tool schemas are left unsanitized and Cloud Code requests can fail at runtime on unsupported JSON Schema keywords.
Useful? React with 👍 / 👎.
Add missing changelog entries for PRs openclaw#56500, openclaw#56540, openclaw#56555, openclaw#56567, openclaw#56573, openclaw#56587, openclaw#56595, openclaw#56612, openclaw#56620.
openclaw#56567) The forward-compat resolver hardcoded 'google' as the provider ID for template lookup, so alias providers (google-vertex, google-gemini-cli) could not find matching templates. Pass the actual provider ID from the runtime context and add a templateProviderId fallback for cross-provider template resolution. Also fix flash-lite prefix ordering — check 'gemini-3.1-flash-lite' before 'gemini-3.1-flash' to prevent misclassification. Add regression tests for pro, flash, and flash-lite across provider aliases. Fixes openclaw#36111
Add missing changelog entries for PRs openclaw#56500, openclaw#56540, openclaw#56555, openclaw#56567, openclaw#56573, openclaw#56587, openclaw#56595, openclaw#56612, openclaw#56620.
openclaw#56567) The forward-compat resolver hardcoded 'google' as the provider ID for template lookup, so alias providers (google-vertex, google-gemini-cli) could not find matching templates. Pass the actual provider ID from the runtime context and add a templateProviderId fallback for cross-provider template resolution. Also fix flash-lite prefix ordering — check 'gemini-3.1-flash-lite' before 'gemini-3.1-flash' to prevent misclassification. Add regression tests for pro, flash, and flash-lite across provider aliases. Fixes openclaw#36111
Add missing changelog entries for PRs openclaw#56500, openclaw#56540, openclaw#56555, openclaw#56567, openclaw#56573, openclaw#56587, openclaw#56595, openclaw#56612, openclaw#56620.
openclaw#56567) The forward-compat resolver hardcoded 'google' as the provider ID for template lookup, so alias providers (google-vertex, google-gemini-cli) could not find matching templates. Pass the actual provider ID from the runtime context and add a templateProviderId fallback for cross-provider template resolution. Also fix flash-lite prefix ordering — check 'gemini-3.1-flash-lite' before 'gemini-3.1-flash' to prevent misclassification. Add regression tests for pro, flash, and flash-lite across provider aliases. Fixes openclaw#36111
Add missing changelog entries for PRs openclaw#56500, openclaw#56540, openclaw#56555, openclaw#56567, openclaw#56573, openclaw#56587, openclaw#56595, openclaw#56612, openclaw#56620.
openclaw#56567) The forward-compat resolver hardcoded 'google' as the provider ID for template lookup, so alias providers (google-vertex, google-gemini-cli) could not find matching templates. Pass the actual provider ID from the runtime context and add a templateProviderId fallback for cross-provider template resolution. Also fix flash-lite prefix ordering — check 'gemini-3.1-flash-lite' before 'gemini-3.1-flash' to prevent misclassification. Add regression tests for pro, flash, and flash-lite across provider aliases. Fixes openclaw#36111
Add missing changelog entries for PRs openclaw#56500, openclaw#56540, openclaw#56555, openclaw#56567, openclaw#56573, openclaw#56587, openclaw#56595, openclaw#56612, openclaw#56620.
openclaw#56567) The forward-compat resolver hardcoded 'google' as the provider ID for template lookup, so alias providers (google-vertex, google-gemini-cli) could not find matching templates. Pass the actual provider ID from the runtime context and add a templateProviderId fallback for cross-provider template resolution. Also fix flash-lite prefix ordering — check 'gemini-3.1-flash-lite' before 'gemini-3.1-flash' to prevent misclassification. Add regression tests for pro, flash, and flash-lite across provider aliases. Fixes openclaw#36111
Add missing changelog entries for PRs openclaw#56500, openclaw#56540, openclaw#56555, openclaw#56567, openclaw#56573, openclaw#56587, openclaw#56595, openclaw#56612, openclaw#56620.
openclaw#56567) The forward-compat resolver hardcoded 'google' as the provider ID for template lookup, so alias providers (google-vertex, google-gemini-cli) could not find matching templates. Pass the actual provider ID from the runtime context and add a templateProviderId fallback for cross-provider template resolution. Also fix flash-lite prefix ordering — check 'gemini-3.1-flash-lite' before 'gemini-3.1-flash' to prevent misclassification. Add regression tests for pro, flash, and flash-lite across provider aliases. Fixes openclaw#36111
Add missing changelog entries for PRs openclaw#56500, openclaw#56540, openclaw#56555, openclaw#56567, openclaw#56573, openclaw#56587, openclaw#56595, openclaw#56612, openclaw#56620.
openclaw#56567) The forward-compat resolver hardcoded 'google' as the provider ID for template lookup, so alias providers (google-vertex, google-gemini-cli) could not find matching templates. Pass the actual provider ID from the runtime context and add a templateProviderId fallback for cross-provider template resolution. Also fix flash-lite prefix ordering — check 'gemini-3.1-flash-lite' before 'gemini-3.1-flash' to prevent misclassification. Add regression tests for pro, flash, and flash-lite across provider aliases. Fixes openclaw#36111
Add missing changelog entries for PRs openclaw#56500, openclaw#56540, openclaw#56555, openclaw#56567, openclaw#56573, openclaw#56587, openclaw#56595, openclaw#56612, openclaw#56620.
Summary
"google"as the provider ID for template lookup, so alias providers (google-vertex,google-gemini-cli) could not find matching templatestemplateProviderIdfallback for cross-provider template resolutiongemini-3.1-flash-litebeforegemini-3.1-flashto prevent misclassificationRoot Cause
resolveGoogle31ForwardCompatModel()inextensions/google/provider-models.tswas called with hardcodedproviderId: "google"fromextensions/google/index.ts:243. When users configuredgoogle-vertexor other aliases, the template lookup failed because no templates existed under that provider ID.Secondary bug:
gemini-3.1-flash-litestarts withgemini-3.1-flash, so without explicit ordering it matched the wrong branch.Change Type
Testing
24 tests pass across 3 test files including new regression coverage for:
Fixes #36111