Skip to content

[Bug] Gemini/Antigravity tool call loses thoughtSignature during Codex continuation #1735

Description

@fhh2626

Client or integration

Codex App

Area

CLI

Summary

When routing Gemini Flash through Antigravity using the OpenAI-compatible
OpenCodex path, tool calls fail after the first tool execution:

Provider error 400:
Function call is missing a thought_signature in functionCall parts.
Function call: default_api:exec

Expected behavior

The thought signature returned with the Gemini function call should be
preserved and sent back in the next assistant tool call.

For OpenAI-compatible format, the field is:

tool_calls[].extra_content.google.thought_signature

Actual behavior

The first model response contains the signature, but the next request
contains the assistant tool call without it.

Impact

Multi-turn tool calling with Gemini Flash through Antigravity fails.
Pi agent works with the same model/tool flow.

Suggested fix

Preserve extra_content.google.thought_signature while:

  1. Parsing streamed tool-call responses.
  2. Accumulating tool-call deltas.
  3. Serializing assistant history for the next request.
  4. Preserving the exact tool-call order and call ID.

The signature must be replayed unchanged in the same tool-call part.

Reference:
https://ai.google.dev/gemini-api/docs/generate-content/thought-signatures

Reproduction

Simply use Codex + gemini v4.7 flash (via gemini outh)

Version

2.19.0

Operating system

Windows 11

Provider and model

No response

Logs or error output

Screenshots and supporting files

No response

Redacted configuration

Checks

  • I searched existing issues and documentation.
  • I removed secrets, tokens, account details, request credentials, and personal data.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcliCLI, config inject, packaging flagsproviderProvider adapters, OpenAI-compat presets, upstream API quirksprovider-compatibilityProvider compatibility reportstoolstool_calls, MCP, web-search / sidecar tools

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions