Skip to content

fix(gemini): replay thought signatures for tool calls - #220

Closed
seanbrar wants to merge 1 commit into
release/2.0.0from
codex/fix-gemini-thought-signatures
Closed

seanbrar wants to merge 1 commit into
release/2.0.0from
codex/fix-gemini-thought-signatures

Conversation

@seanbrar

Copy link
Copy Markdown
Owner

Summary

Preserve Gemini function-call thought signatures and call IDs in opaque continuation state, then replay them with tool results for normal, streaming, and deferred interactions. This fixes Gemini 3 tool continuations that previously failed with 400: Function call is missing a thought_signature.

Related issue

None

Test plan

  • just check
    • Ruff formatting and lint passed
    • documentation lint passed
    • mypy passed
    • 474 non-API tests passed (20 API tests deselected)
  • ENABLE_API_TESTS=1 uv run pytest tests/test_api.py::test_gemini3_tool_call_signature_roundtrip -q
    • Gemini 3 Flash Preview completed the signed two-turn tool loop with HTTP 200 responses
  • ENABLE_API_TESTS=1 uv run pytest tests/test_api.py::test_live_tool_calls_conversation_and_reasoning_roundtrip[gemini] -q
    • Gemini 2.5 Flash Lite completed the existing tool round-trip with HTTP 200 responses
  • Added focused provider contract coverage for signature extraction, continuation replay, call/result IDs, and streaming state preservation

Notes

Intended for the 2.0.0 RC3 release line. Signatures remain provider-bound and opaque: callers should keep using the untouched Pollux continuation until a pending Gemini tool exchange is complete. Portable application-authored history intentionally does not expose provider signatures.


  • PR title follows conventional commits
  • just check passes
  • Tests cover the meaningful cases, not just the happy path
  • Docs updated (if this changes public API or user-facing behavior)

@codecov

codecov Bot commented Jul 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.00000% with 9 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/pollux/providers/gemini.py 85.00% 9 Missing ⚠️

📢 Thoughts on this report? Let us know!

@seanbrar seanbrar closed this Jul 14, 2026
@seanbrar
seanbrar deleted the codex/fix-gemini-thought-signatures branch July 14, 2026 12:18
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