Skip to content

fix(google): replay Gemini thought signatures on follow-up turns - #289

Merged
ltmoerdani merged 1 commit into
mainfrom
fix/gemini-thought-signature
Nov 25, 2026
Merged

ltmoerdani merged 1 commit into
mainfrom
fix/gemini-thought-signature

Conversation

@ltmoerdani

Copy link
Copy Markdown
Owner

Gemini 4 Hydrogen on Zen failed on follow-up turns. Google requires the opaque thoughtSignature from a response to be replayed on the next turn for Gemini 3+ with thinking enabled. Our Google normalizers dropped it and the request builder never sent it back.

What changed:

  • core/routing.ts keeps signatures from stream and full responses, including signature-only events that used to be treated as empty.
  • transports/google.ts and transports/extractors.ts capture signatures across SSE events and emit one internal transcript part after the stream.
  • chatParts.ts carries that part through Copilot Chat history as an invisible data part. provider/messages.ts reads it back, and history normalization keeps and merges it.
  • request/google.ts replays each signature as a trailing part on the next model turn, including after tool calls.

Checks: npm run compile clean, npm run lint 7/7, 11 new unit tests pass. npm run package and the E2E retry test were not run here. Live Gemini 4 Hydrogen verification is still pending, so I'd treat this as ready for review rather than confirmed fixed on the model.

docs/issues/128-20261126-gemini-thought-signature-and-triage.md also records the verdicts for the other reports: Haiku 5.5 compaction is upstream VS Code #336797, the gpt-6.2-sol skill loader arguments come from the model, and the globalState warning is older debt. None of those are changed here.

Gemini 3+ (gemini-4-hydrogen on Zen) rejected follow-up turns with MISSING_THOUGHT_SIGNATURE because the Google normalizers dropped the opaque thoughtSignature from response parts and the request builder never sent it back.

Signatures are now captured across SSE events, carried through the Copilot Chat transcript as an invisible internal data part, and replayed as trailing parts on the next model turn. Signature-only events are no longer discarded, and history normalization keeps/merges signatures instead of dropping them.

Also records the verdicts for the other reported findings (upstream VS Code #336797, gpt-6.2-sol tool arguments, globalState growth) in docs/issues/128.
@ltmoerdani
ltmoerdani merged commit a368c5a into main Nov 25, 2026
2 checks passed
ltmoerdani added a commit that referenced this pull request Nov 25, 2026
Bump package.json and package-lock.json to 0.8.2, promote the Unreleased changelog section to 0.8.2 (2026-11-26), and update the architecture map version surface.

Documentation: add the PR #289 session record (docs/issues/129), reconcile doc 128 with the merge status and remaining verification gaps, and preserve the globalState limitation and Agent Host caveat notes in the related feature/reference docs.
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