Skip to content

Gemini tool-calls fail after first step because thought_signature is dropped #727

Closed

Description

@pruales

Disclaimer: this was found and patched locally by codex while i was working on a personal project. Apologies if this is off base.

When using DurableAgent with Gemini thinking models and tools, follow‑up steps fail with:
“Function call is missing a thought_signature in functionCall parts…”
This happens because the workflow reconstructs tool‑call history without providerOptions, so the Gemini adapter can’t read thoughtSignature.

Environment

  • @workflow/ai: 4.0.1-beta.40
  • ai: 6.0.5
  • @ai-sdk/google: 3.0.2
  • Model: gemini-3-flash-preview (thinking enabled)

Repro

  1. Use DurableAgent with Gemini model + tools.
  2. A tool call is generated and executed.
  3. Next step errors:
    “Function call is missing a thought_signature in functionCall parts…”

Root cause
In packages/ai/src/agent/stream-text-iterator.ts, when finishReason === 'tool-calls', the tool call is appended without providerOptions:

conversationPrompt.push({
  role: 'assistant',
  content: toolCalls.map((toolCall) => ({
    type: 'tool-call',
    toolCallId: toolCall.toolCallId,
    toolName: toolCall.toolName,
    input: JSON.parse(toolCall.input),
    // providerOptions missing
  })),
});

The Gemini adapter reads thoughtSignature from part.providerOptions.google.thoughtSignature, not providerMetadata, so the next request fails.

Proposed fix
Pass provider metadata through providerOptions when reconstructing tool‑calls:

  ...(toolCall.providerMetadata
    ? { providerOptions: toolCall.providerMetadata }
    : {}),

Additional context
We patched node_modules/@workflow/ai/dist/agent/stream-text-iterator.js locally and the error disappears.

Activity

  1. added 2 commits that reference this issue on Jan 7, 2026
    0750d5b
    7da7897
  2. self-assigned this
    on Jan 7, 2026
  3. pranaygp commented on Jan 7, 2026

    @pranaygp
    Contributor

    Opened #733 to fix this

  4. pruales commented on Jan 7, 2026

    @pruales
    Author

    Opened #733 to fix this

    verified it works locally for me! thanks!

  5. added a commit that references this issue on Jan 8, 2026
    4b43186
  6. added a commit that references this issue on Jan 12, 2026
    61fdb41
  7. added a commit that references this issue on Jan 16, 2026
    8804c48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions