openclaw - 💡(How to fix) Fix Google Gemini subagents hang after stream-ready with 0 tokens (google-generative-ai provider)

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Code Example

openclaw infer model run --model google/gemini-2.5-pro

---

lost active execution context

---

bundle-tools:5512ms
system-prompt
session-resource-loader
stream-setup:~3.4s
phase=stream-ready
RAW_BUFFERClick to expand / collapse

Environment

  • OpenClaw version: 2026.5.7 (eeef486), macOS arm64
  • Provider: google (Google AI Studio, GEMINI_API_KEY)

Models affected

  • google/gemini-2.5-pro
  • google/gemini-2.5-flash

Behaviour

Running Gemini directly via infer works correctly:

openclaw infer model run --model google/gemini-2.5-pro

However, spawning a subagent via sessions_spawn with model=google/gemini-2.5-pro hangs indefinitely with 0 tokens in/out. It eventually fails with:

lost active execution context

The same hang occurs with google/gemini-2.5-flash.

Log evidence

The subagent reaches phase=stream-ready in roughly 5-6 seconds, then stalls. The setup phases complete successfully, for example:

bundle-tools:5512ms
system-prompt
session-resource-loader
stream-setup:~3.4s
phase=stream-ready

After that, no tokens are ever produced: 0 input / 0 output tokens, and the embedded agent loop never progresses.

Related pattern

This looks identical in pattern to the GPT-5.5 Responses API streaming bug fixed in 2026.5.7 (#73053): the provider reaches stream-ready, but streaming events appear not to be handled correctly by the embedded agent loop.

In this case, streaming events from Google's generative AI provider appear to not be handled correctly in subagent execution, even though direct infer model run succeeds for some Gemini models.

Attempted

All of the following hang the same way when used for subagents:

  • google/gemini-2.5-pro
  • google/gemini-2.5-flash
  • lightContext:true

Model checks

Confirmed NOT working via infer model run — return No text output:

  • gemini-3.1-pro-preview
  • gemini-3-pro-preview
  • gemini-pro-latest
  • gemini-2.0-flash

Confirmed working via infer model run only:

  • gemini-2.5-pro
  • gemini-2.5-flash
  • gemini-3.1-flash-lite-preview

Expected behaviour

Gemini models that work via openclaw infer model run should also work when used as subagent models. Once the subagent reaches phase=stream-ready, generated content/tool events should be consumed by the embedded agent loop instead of stalling indefinitely at 0 tokens.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix Google Gemini subagents hang after stream-ready with 0 tokens (google-generative-ai provider)