-
-
Notifications
You must be signed in to change notification settings - Fork 69.5k
[Bug]: sessions_spawn silently falls back to Anthropic (set fallback model) when targeting Google Gemini models on spawned subagent tasks. #36134
Description
Bug type
Behavior bug (incorrect output/state without crash)
Summary
When sessions_spawn targets a Google/Gemini model via either alias ("gemini") or full provider ID ("google/gemini-3.1-flash-lite-preview"), the session returns modelApplied: true but the sub-agent actually runs on the configured fallback provider (Anthropic/Sonnet). The model override is silently ignored with zero error or warning.
Steps to reproduce
- Configure OpenClaw with both anthropic and google authentication profiles
- Spawn a sub-agent: sessions_spawn({ task: "Identify yourself", model: "google/gemini-3.1-flash-lite-preview", mode: "run" })
- Observe: modelApplied: true is returned in the response
- Check actual output: sub-agent identifies itself as Anthropic/Claude (e.g., "I'm Claude...")
- Repeat with alias: sessions_spawn({ ..., model: "gemini", ... })
- Result: Same silent fallback to Anthropic
Expected behavior
Sub-agent is created and runs on the Google Gemini model specified. If the Google provider is unavailable or unconfigured, return an error with modelApplied: false and a clear message explaining why the override failed.
Actual behavior
Sub-agent is created with modelApplied: true in the response, but the sub-agent actually runs on Anthropic/Claude (Sonnet or configured default).
The model override is silently ignored — no error, no warning, no log at any level. modelApplied: true is actively misleading.
OpenClaw version
2026.3.3, commit 809f951
Operating system
macOS 12.7.4 / Darwin 21.6.0 (x64)
Install method
npm / development
Logs, screenshots, and evidence
**Test Matrix: Model Parameter vs Actual Provider**
| Model Parameter | Intended Provider | Actual Provider | Result |
|---|---|---|---|
| `gemini` (alias) | Google | Anthropic | ❌ Silent fallback to Sonnet |
| `google/gemini-3.1-flash-lite-preview` (full ID) | Google | Anthropic | ❌ Silent fallback to Sonnet |
| `grok` (alias) | xAI | xAI | ✅ Correct provider |
| `xai/grok-4-1-fast` (full ID) | xAI | xAI | ✅ Correct provider |
**Evidence:** Provider switching works correctly for xAI (both alias and full ID). Same code path, same auth profiles configured, but Google routes to fallback silently while xAI works as expected.
**Cost impact:** Gemini 3.1 Flash Lite = $1.50/MTok output. Sonnet 4.6 = $15/MTok output. Silent fallback = 10x cost increase with no visibility.
**Metadata misleading:** Session response includes `modelApplied: true` even though the actual model is different.Impact and severity
Affected: Multi-model pipelines attempting to use Google Gemini models (including Guardian screening workflows, cost-optimised deployments, and model diversity experiments).
Severity: HIGH (breaks model selection and cost control).
Frequency: 100% reproducible — occurs every time sessions_spawn targets a Google model.
Consequence:
- Silent 10x cost increase (Gemini $1.50/MTok → Sonnet $15/MTok)
- modelApplied metadata misleading — no visibility into actual routing failure
- Model diversity experiments broken — user expects Gemini, gets Sonnet
- Guardian pipelines lose provider flexibility
Additional information
Workaround: Explicitly using Anthropic models works correctly. Users can work around this by avoiding Google models for now.
Related: This routing bug has a significant cost impact on Guardian workflows — our testing showed we've been accidentally running on Sonnet (10x cost) while believing we were using Gemini. The fix/subagent-announce-delivery branch is already being worked on; this may be related to provider routing changes in that PR.
Tested with: anthropic:default and google:default auth profiles both configured and live.