Skip to content

fix #76071: handle thoughtSignature-only parts to prevent Gemini stream hang#76080

Merged
obviyus merged 2 commits into
openclaw:mainfrom
zhangguiping-xydt:feat/issue-76071
May 2, 2026
Merged

fix #76071: handle thoughtSignature-only parts to prevent Gemini stream hang#76080
obviyus merged 2 commits into
openclaw:mainfrom
zhangguiping-xydt:feat/issue-76071

Conversation

@zhangguiping-xydt

Copy link
Copy Markdown
Contributor

Summary

Fixes #76071 — Gemini 3.1 Pro Preview hangs in agent runtime

Issue

[Bug]: Gemini 3.1 Pro Preview hangs in agent runtime; direct API works in seconds, openclaw idle-times-out at full timeoutSeconds

Changes

  • fix(google): handle thoughtSignature-only parts to prevent Gemini stream hang

Changed Files

extensions/google/transport-stream.test.ts | 100 +++++++++++++++++++++++++++++
extensions/google/transport-stream.ts      |  39 +++++++++++

Root Cause

Gemini 3.1 Pro Preview may emit parts with only thoughtSignature and no text content, causing the transport stream to stall at idle-timeout.

Fix

Emit a thinking_signature event for thoughtSignature-only parts to keep the stream active, and start a thinking block when these parts arrive before any text.

@clawsweeper

clawsweeper Bot commented May 2, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

Summary
The PR updates the Google transport to yield thinking activity for Gemini thoughtSignature-only SSE parts, adds targeted regression tests, and records the user-facing fix in the changelog.

Reproducibility: yes. for the transport liveness gap: current main parses signature-only Google SSE parts without yielding an event, while the idle watchdog only resets after yielded events. The full production hang still depends on live Gemini behavior, which was not rerun in this read-only review.

Next step before merge
No repair lane: the latest branch has no actionable code findings; the remaining work is normal CI completion and maintainer merge judgment.

Security
Cleared: The diff only touches Google provider stream parsing, its tests, and the changelog, with no dependency, workflow, secret, install, release, or package-resolution changes.

Review details

Best possible solution:

Land the Google-owned transport fix once required CI is green, keeping the activity signal within the existing AssistantMessageEvent protocol.

Do we have a high-confidence way to reproduce the issue?

Yes for the transport liveness gap: current main parses signature-only Google SSE parts without yielding an event, while the idle watchdog only resets after yielded events. The full production hang still depends on live Gemini behavior, which was not rerun in this read-only review.

Is this the best way to solve the issue?

Yes. Handling signature-only chunks in the Google transport with an empty thinking_delta is narrower than changing the core idle-timeout wrapper and stays within the pinned stream event contract.

What I checked:

Likely related people:

  • steipete: Recent path history shows Google transport extraction, Google thinking behavior, Vertex auth, and idle-timeout policy work, and current-main blame covers the Google stream loop in this shallow checkout. (role: recent maintainer / adjacent owner; confidence: high; commits: 85826c83e4a1, cc0f3067a003, 0b59964ec945; files: extensions/google/transport-stream.ts, extensions/google/transport-stream.test.ts, src/agents/pi-embedded-runner/run/llm-idle-timeout.ts)
  • liuy: GitHub path history attributes the original LLM idle-timeout streaming watchdog to this contributor, which is the core liveness behavior exposed by the Google transport gap. (role: introduced behavior; confidence: medium; commits: 84b72e66b918; files: src/agents/pi-embedded-runner/run/llm-idle-timeout.ts)
  • ericberic: Recent Google transport and test history includes Gemini thinking-budget fixes in the same provider test surface touched by this PR. (role: recent Google transport contributor; confidence: medium; commits: edca8c721a69; files: extensions/google/transport-stream.ts, extensions/google/transport-stream.test.ts)
  • obviyus: Current history shows adjacent work unifying idle timeout with the runner abort path, which is relevant to the liveness boundary this PR exercises. (role: adjacent idle-timeout maintainer; confidence: medium; commits: 179f713c88c6; files: src/agents/pi-embedded-runner/run/llm-idle-timeout.ts)

Remaining risk / open question:

  • Two GitHub check-runs were still in progress in the reviewed snapshot; merge should wait for required CI to finish.
  • This read-only review did not perform a live Gemini 3.1 end-to-end run; confidence comes from the deterministic transport fixture and the linked issue's provider evidence.

Codex review notes: model gpt-5.5, reasoning high; reviewed against 473fc0aad84a.

…eam hang

Gemini 3.1 Pro Preview may emit parts with only thoughtSignature
and no text content, causing the stream to stall. Emit a
thinking_signature event to keep the stream active, and start
a thinking block when these parts arrive before any text.

Fixes openclaw#76071
@obviyus
obviyus force-pushed the feat/issue-76071 branch from 45adc10 to 534445c Compare May 2, 2026 13:46
@obviyus obviyus self-assigned this May 2, 2026
@obviyus
obviyus force-pushed the feat/issue-76071 branch from 534445c to 3ef2ced Compare May 2, 2026 13:55

@obviyus obviyus left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Verified the Google transport liveness bug: signature-only Gemini thinking chunks now flow through the existing thinking event protocol instead of the out-of-contract event added earlier.

Maintainer follow-up: simplified the stream path, removed the extra comment, normalized the changelog entry, and rebased onto current main.

Local gate: skipped tests per maintainer request; changelog formatting and attribution checks ran.

@obviyus
obviyus merged commit a55b2af into openclaw:main May 2, 2026
69 of 71 checks passed
@obviyus

obviyus commented May 2, 2026

Copy link
Copy Markdown
Contributor

Landed on main.

Thanks @zhangguiping-xydt.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 9, 2026
@clawsweeper clawsweeper Bot mentioned this pull request May 12, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
sablehead pushed a commit to sablehead/openclaw that referenced this pull request Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Gemini 3.1 Pro Preview hangs in agent runtime; direct API works in seconds, openclaw idle-times-out at full timeoutSeconds

2 participants