Skip to content

fix(streaming): preserve Gemini thought signatures in streamed tool calls#2997

Merged
teknium1 merged 1 commit intomainfrom
hermes/hermes-7d7ac769
Mar 25, 2026
Merged

fix(streaming): preserve Gemini thought signatures in streamed tool calls#2997
teknium1 merged 1 commit intomainfrom
hermes/hermes-7d7ac769

Conversation

@teknium1
Copy link
Copy Markdown
Contributor

Summary

Gemini 3 thinking models include extra_content metadata (containing thought_signature) on tool call responses. This signature must be replayed on subsequent API calls or Gemini rejects the request with HTTP 400.

The non-streaming path already preserved extra_content (line ~4446 in run_agent.py), but the streaming accumulator rebuilt tool calls from deltas without carrying provider-specific metadata through. This caused Gemini tool loops to fail once a streamed tool call was replayed.

Fix

  • Capture extra_content from stream deltas during tool call accumulation (checks both direct attribute and model_extra dict for SDK compatibility)
  • Pass it through to the reconstructed SimpleNamespace tool calls

Cherry-picked from PR #2803 by @meditation-error.

Test plan

  • New test: test_tool_call_extra_content_preserved verifies thought_signature survives the streaming accumulator
  • All streaming tests pass (2 pre-existing failures in TestStreamingFallback unrelated)

@teknium1 teknium1 merged commit 61949f0 into main Mar 25, 2026
1 of 2 checks passed
InB4DevOps pushed a commit to InB4DevOps/hermes-agent that referenced this pull request Mar 25, 2026
Co-authored-by: Jack <jvand@DESKTOP-JACK.localdomain>
outsourc-e pushed a commit to outsourc-e/hermes-agent that referenced this pull request Mar 26, 2026
Co-authored-by: Jack <jvand@DESKTOP-JACK.localdomain>
StreamOfRon pushed a commit to StreamOfRon/hermes-agent that referenced this pull request Mar 29, 2026
Co-authored-by: Jack <jvand@DESKTOP-JACK.localdomain>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant