fix: strip Google provider prefix from Gemini paths#91125
Conversation
|
Land-ready verification for this patch:
Known gap: I did not run a full live OpenClaw subagent session. The live API repro covers the provider 404, and the focused transport/model/subagent tests cover the OpenClaw path that builds the bad Google URL. |
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: fix: strip Google provider prefix from Gemini paths This is item 1/1 in the current shard. Shard 0/1. This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
7e24be8 to
18aaffa
Compare
|
CI follow-up after rebasing onto current
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 18aaffa56b
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| return modelId; | ||
| } | ||
| return `models/${modelId}`; | ||
| return `models/${stripGoogleProviderPrefix(modelId)}`; |
There was a problem hiding this comment.
Strip prefix before resource-path check
When the runtime gets a provider-scoped full Gemini resource such as google/tunedModels/foo (the same provider/model shape this patch is fixing), this line strips the prefix only after the models//tunedModels/ check and then prepends models/, producing models/tunedModels/foo. The Gemini API expects tuned resources to stay under tunedModels/foo, so configured tuned/custom model refs still 404; strip google/ before checking for full resource paths.
Useful? React with 👍 / 👎.
* fix: strip Google provider prefix from Gemini paths * test: align qa exit code type
* fix: strip Google provider prefix from Gemini paths * test: align qa exit code type
Summary
Fixes #71932.
Native Google Gemini transport now strips a redundant same-provider
google/prefix before constructing Gemini API REST paths. This keeps configured model matching/provider-scoped IDs intact while sendingmodels/gemini-3-flash-previewto Google instead of the invalidmodels/google/gemini-3-flash-previewpath.Verification
GEMINI_API_KEYfrom 1Password:models/google/gemini-3-flash-preview:generateContentreturned 404;models/gemini-3-flash-preview:generateContentreturned 200.generateContentandstreamGenerateContentendpoints ashttps://generativelanguage.googleapis.com/v1beta/{model=models/*}:...with model formatmodels/{model}.node scripts/run-vitest.mjs extensions/google/transport-stream.test.tsnode scripts/run-vitest.mjs src/agents/embedded-agent-runner/model.test.tsnode scripts/run-vitest.mjs src/agents/openclaw-tools.subagents.sessions-spawn.model.test.tspnpm exec oxfmt --check --threads=1 extensions/google/model-id.ts extensions/google/transport-stream.ts extensions/google/transport-stream.test.tsgit diff --checkpnpm tsgo:extensionspnpm lint:extensionspnpm check:test-types