Skip to content

fix: strip Google provider prefix from Gemini paths#91125

Merged
steipete merged 2 commits into
mainfrom
fix/google-model-prefix-transport
Jun 7, 2026
Merged

fix: strip Google provider prefix from Gemini paths#91125
steipete merged 2 commits into
mainfrom
fix/google-model-prefix-transport

Conversation

@steipete

@steipete steipete commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

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 sending models/gemini-3-flash-preview to Google instead of the invalid models/google/gemini-3-flash-preview path.

Verification

  • Live Gemini API proof with GEMINI_API_KEY from 1Password: models/google/gemini-3-flash-preview:generateContent returned 404; models/gemini-3-flash-preview:generateContent returned 200.
  • Google Gemini API docs define generateContent and streamGenerateContent endpoints as https://generativelanguage.googleapis.com/v1beta/{model=models/*}:... with model format models/{model}.
  • node scripts/run-vitest.mjs extensions/google/transport-stream.test.ts
  • node scripts/run-vitest.mjs src/agents/embedded-agent-runner/model.test.ts
  • node scripts/run-vitest.mjs src/agents/openclaw-tools.subagents.sessions-spawn.model.test.ts
  • pnpm exec oxfmt --check --threads=1 extensions/google/model-id.ts extensions/google/transport-stream.ts extensions/google/transport-stream.test.ts
  • git diff --check
  • pnpm tsgo:extensions
  • pnpm lint:extensions
  • pnpm check:test-types
  • Autoreview: clean, no accepted/actionable findings.

@steipete

steipete commented Jun 7, 2026

Copy link
Copy Markdown
Contributor Author

Land-ready verification for this patch:

  • Live Gemini API proof with GEMINI_API_KEY from 1Password: models/google/gemini-3-flash-preview:generateContent returned 404; models/gemini-3-flash-preview:generateContent returned 200.
  • Current Google Gemini API docs define the REST path as {model=models/*} / models/{model}, matching the bare model path used after this fix.
  • node scripts/run-vitest.mjs extensions/google/transport-stream.test.ts passed, including the new prefixed-model URL regression.
  • node scripts/run-vitest.mjs src/agents/embedded-agent-runner/model.test.ts passed.
  • node scripts/run-vitest.mjs src/agents/openclaw-tools.subagents.sessions-spawn.model.test.ts passed.
  • pnpm exec oxfmt --check --threads=1 extensions/google/model-id.ts extensions/google/transport-stream.ts extensions/google/transport-stream.test.ts passed.
  • git diff --check passed.
  • pnpm tsgo:extensions passed.
  • pnpm lint:extensions passed.
  • pnpm check:test-types passed.
  • Autoreview passed with no accepted/actionable findings.

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

clawsweeper Bot commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

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.

@steipete steipete force-pushed the fix/google-model-prefix-transport branch from 7e24be8 to 18aaffa Compare June 7, 2026 08:45
@steipete

steipete commented Jun 7, 2026

Copy link
Copy Markdown
Contributor Author

CI follow-up after rebasing onto current origin/main:

  • Reproduced the failing CI check-test-types locally after rebase.
  • Fixed the newly inherited QA test type annotation for process.exitCode; no runtime behavior change.
  • pnpm check:test-types passed.
  • node scripts/run-vitest.mjs extensions/qa-lab/src/live-transports/whatsapp/cli.runtime.test.ts passed.
  • Re-ran Google/subagent proof after rebase: node scripts/run-vitest.mjs extensions/google/transport-stream.test.ts, node scripts/run-vitest.mjs src/agents/embedded-agent-runner/model.test.ts, node scripts/run-vitest.mjs src/agents/openclaw-tools.subagents.sessions-spawn.model.test.ts all passed.
  • pnpm exec oxfmt --check --threads=1 extensions/google/model-id.ts extensions/google/transport-stream.ts extensions/google/transport-stream.test.ts extensions/qa-lab/src/live-transports/whatsapp/cli.runtime.test.ts passed.
  • git diff --check passed.
  • Autoreview rerun: clean, no accepted/actionable findings.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 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)}`;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

@steipete steipete merged commit 3e4b10f into main Jun 7, 2026
161 of 163 checks passed
@steipete steipete deleted the fix/google-model-prefix-transport branch June 7, 2026 08:49
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jun 8, 2026
* fix: strip Google provider prefix from Gemini paths

* test: align qa exit code type
wangmiao0668000666 pushed a commit to wangmiao0668000666/openclaw that referenced this pull request Jun 9, 2026
* fix: strip Google provider prefix from Gemini paths

* test: align qa exit code type
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] 404 Model Not Found when spawning sub-agents with google/gemini-3.1-flash-lite-preview

1 participant