[PR #8262] [MERGED] fix(llm): send a tool call's Gemini thought signature back on the next round #8253

Closed
opened 2026-10-26 04:04:07 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/8262
Author: @kolacheee
Created: 10/24/2026
Status: ✅ Merged
Merged: 10/24/2026
Merged by: @kolacheee

Base: staging ← Head: claude/game-mode-cloud-nx3wjf


📝 Commits (1)

  • 6ffe327 fix(llm): send a tool call's Gemini thought signature back on the next round

📊 Changes

3 files changed (+125 additions, -8 deletions)

View changed files

📝 packages/server/src/services/llm/providers/openai.provider.ts (+30 -1)
📝 packages/shared/src/types/generation-integration.ts (+4 -0)
📝 scripts/regressions/provider-compat.regression.ts (+91 -7)

📄 Description

Linked issue

Closes #8261

Why this change

  • Before: with a Gemini 3 model on an OpenAI-compatible connection, a turn that called a tool failed on its next round with 400 "Function call is missing a thought_signature in functionCall parts".
  • After: the tool round goes through, because each call goes back with the thought signature Gemini gave it.

What changed

  • The OpenAI-compatible adapter keeps a tool call's extra_content (Gemini's OpenAI endpoint puts the call's thought signature in extra_content.google.thought_signature), streamed or not. A streamed call merges what later deltas add to it.
  • LLMToolCall carries that extra_content, so the tool loop sends it back on the call unchanged. Only a provider that sent it gets it back.
  • How: the call is read and written as it already was. The only addition is the one optional field, kept through normalization and stream accumulation.

Validation

  • Shared build, server typecheck, prettier and check-locales pass locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Manual verification notes

  • provider-compat.regression.ts has two new cases. In the first, a non-streamed call with a signature keeps it, and the next round sends it back on the call. In the second, a streamed call keeps the signature from its opening delta while its arguments come in later ones. claude-opus55.regression.ts passes too.
  • The fix has not been tried against a live Gemini endpoint. The failure was seen in a playtest on a Gemini 3 model through an OpenAI-compatible proxy.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/8262 **Author:** [@kolacheee](https://github.com/kolacheee) **Created:** 10/24/2026 **Status:** ✅ Merged **Merged:** 10/24/2026 **Merged by:** [@kolacheee](https://github.com/kolacheee) **Base:** `staging` ← **Head:** `claude/game-mode-cloud-nx3wjf` --- ### 📝 Commits (1) - [`6ffe327`](https://github.com/Pasta-Devs/Marinara-Engine/commit/6ffe327ea763b5f75a4b36674c0ac28d85594cf9) fix(llm): send a tool call's Gemini thought signature back on the next round ### 📊 Changes **3 files changed** (+125 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `packages/server/src/services/llm/providers/openai.provider.ts` (+30 -1) 📝 `packages/shared/src/types/generation-integration.ts` (+4 -0) 📝 `scripts/regressions/provider-compat.regression.ts` (+91 -7) </details> ### 📄 Description ## Linked issue Closes #8261 ## Why this change - Before: with a Gemini 3 model on an OpenAI-compatible connection, a turn that called a tool failed on its next round with 400 "Function call is missing a thought_signature in functionCall parts". - After: the tool round goes through, because each call goes back with the thought signature Gemini gave it. ## What changed - The OpenAI-compatible adapter keeps a tool call's `extra_content` (Gemini's OpenAI endpoint puts the call's thought signature in `extra_content.google.thought_signature`), streamed or not. A streamed call merges what later deltas add to it. - `LLMToolCall` carries that `extra_content`, so the tool loop sends it back on the call unchanged. Only a provider that sent it gets it back. - How: the call is read and written as it already was. The only addition is the one optional field, kept through normalization and stream accumulation. ## Validation - [x] Shared build, server typecheck, prettier and `check-locales` pass locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [x] Read and followed `CONTRIBUTING.md` ### Manual verification notes - `provider-compat.regression.ts` has two new cases. In the first, a non-streamed call with a signature keeps it, and the next round sends it back on the call. In the second, a streamed call keeps the signature from its opening delta while its arguments come in later ones. `claude-opus55.regression.ts` passes too. - The fix has not been tried against a live Gemini endpoint. The failure was seen in a playtest on a Gemini 3 model through an OpenAI-compatible proxy. ## Docs and release impact - [x] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-26 04:04:07 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#8253
No description provided.