Skip to content

Gemini 3 Pro: Multi-turn tool calls fail because thought_signature is not preserved via OpenAI compatibility layer #7519

Closed

Description

@squld

What version of Codex is running?

codex-cli 0.64.0

What subscription do you have?

Gemini 3 Pro via Vertex AI API on GCP

Which model were you using?

google/gemini-3-pro-preview

What platform is your computer?

Linux 6.17.8-orbstack-00308-g8f9c941121b1 aarch64 unknown

What issue are you seeing?

› Review README.md

• Explored
└ Read README.md

■ unexpected status 400 Bad Request: [{
"error": {
"code": 400,
"message": "Unable to submit request because function call default_api:shell in the 4. content block
is missing a thought_signature. Learn more: https://docs.cloud.google.com/vertex-ai/generative-ai/docs/
thought-signatures",
"status": "INVALID_ARGUMENT"
}
}
]

What steps can reproduce the bug?

Environment / Setup

  • Backend model: google/gemini-3-pro-preview

  • Access method: OpenAI compatibility layer as described in the Gemini 3 docs
    https://docs.cloud.google.com/vertex-ai/generative-ai/docs/start/get-started-with-gemini-3

  • Scenario: Multi-turn conversation with tool calls enabled

  • config.toml:

    model = "google/gemini-3-pro-preview"
    model_provider = "gemini-via-openai-compatibility-layer"
    
    [model_providers.gemini-via-openai-compatibility-layer]
    name = "Gemini via OpenAI compatibility layer"
    base_url = "https://aiplatform.googleapis.com/v1/projects/{PROJECT_ID}/locations/global/endpoints/openapi"
    env_key = "OPENAI_API_KEY"
    wire_api = "chat"
    query_params = {}

Reproduce Steps

$ touch README.md
$ export OPENAI_API_KEY=XXXX
$ codex
╭───────────────────────────────────────────────────────────╮
│ >_ OpenAI Codex (v0.64.0)                                 │
│                                                           │
│ model:     google/gemini-3-pro-preview   /model to change │
│ directory: /workspaces               │
╰───────────────────────────────────────────────────────────╯

  To get started, describe a task or try one of these commands:

  /init - create an AGENTS.md file with instructions for Codex
  /status - show current session configuration
  /review - review any changes and find issues

› Review README.md


• Explored
  └ Read README.md

■ unexpected status 400 Bad Request: [{
  "error": {
    "code": 400,
    "message": "Unable to submit request because function call `default_api:shell` in the 4. content block
is missing a `thought_signature`. Learn more: https://docs.cloud.google.com/vertex-ai/generative-ai/docs/
thought-signatures",
    "status": "INVALID_ARGUMENT"
  }
}
]

What is the expected behavior?

In multi-turn conversations with tool calls, Codex CLI should:

  • Preserve the Gemini thought_signature across turns for each tool call.
  • Successfully continue the agent loop without 400 INVALID_ARGUMENT errors.

Additional information

Likely root cause (based on related issue)

The behavior appears to match the previously reported issue in openai-agents-js:

From that PR, the root cause was:

  • Non-streaming mode: providerData was set from the overall response metadata (result.providerMetadata) instead of the per-tool-call metadata (toolCall.providerMetadata), which actually contains the thoughtSignature.
  • Streaming mode: providerData from tool-call parts was not captured at all.

As a result, the thought_signature was lost between iterations of the agent loop, causing Gemini to reject subsequent function calls.

Codex CLI seems to be hitting the same class of problem when used with Gemini 3 Pro via the OpenAI compatibility layer.

References

Activity

  1. added
    bug
    on Dec 3, 2025
  2. added
    CLI
    custom-model
    tool-calls
    on Dec 3, 2025
  3. added and removed
    tool-calls
    on Dec 3, 2025
  4. etraut-openai commented on Dec 9, 2025

    @etraut-openai
    Contributor

    Thanks for the bug report.

    We're announcing that we plan to deprecate support for the chat/completions API in Codex and eventually remove support completely. For details, please refer to #7782, which provides the rationale and timeline.

    Please switch to the responses wire API in your configuration and see if that addresses the problem you're seeing.

  5. squld commented on Dec 11, 2025

    @squld
    Author

    Thanks for your response.

    As far as I can tell, Google does not currently have any plans to provide an OpenAI Responses API compatibility layer for Gemini, only the Chat Completions-compatible one I'm using now.

    Given that, I'll go ahead and withdraw this issue.

    Separately, I'm planning to experiment with using https://github.com/open-responses/open-responses as a proxy layer to see if that can bridge the gap.

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

    CLIbugcustom-model

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions