ag-ui-protocol / ag-ui-protocol/ag-ui

[Bug]: Gemini 2.5 or 3 tool calls fail with missing thought_signature in @ag-ui/mastra roundtrip (frontend/client tool flows)

未关闭
#1,245 4 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
bug
主要语言
Python
星标
15.9k
派生
1.4k
平均合并
1 天 17 小时
30 天内合并 PR
163

描述

### Pre-flight Checklist

- [x] I have searched [existing issues](https://github.com/ag-ui-protocol/ag-ui/issues) and this hasn't been reported yet.
- [x] I am using the **latest** version AG-UI.

### Describe the Bug

We’re seeing consistent failures with Gemini >= 2.5 models when using @ag-ui/mastra with tool use flows that involve frontend/client tools (CopilotKit useComponent / HITL-style interactions).
The run fails with:
{
"type": "RUN_ERROR",
"message": "AI_APICallError: Function call is missing a thought_signature in functionCall parts. This is required for tools to work correctly, and missing thought_signature may lead to degraded model performance. Additional data, function call `default_api:get-current-date` , position 9. Please refer to https://ai.google.dev/gemini-api/docs/thought-signatures for more details.",
"code": "INCOMPLETE_STREAM"
}
This appears to be Gemini >= 2.5 specific, and relates to when frontend tools are used (via copilotkit).

### Steps to Reproduce

Steps to Reproduce
1. Use @ag-ui/mastra as the runtime adapter with Mastra + CopilotKit.
2. Configure a Gemini 3 model (for example gemini-3.1-flash-lite-preview) via @ai-sdk/google.
3. Register at least:
- one frontend only tool (e.g. UI card/HITL).
4. Run a conversation that triggers a round trip - Agent -> client tool call -> agent.
5. Observe stream failure with missing thought_signature / INCOMPLETE_STREAM.

### Expected Behavior

Tool-calling conversation should continue normally with Gemini 2.5/3, with no thought_signature validation error.
thought_signature preserved.

### Environment

```text
- @ag-ui/mastra: 1.0.0
- @ag-ui/core: 0.0.47
- @copilotkit/runtime: 1.52.1
- @mastra/core: 1.9.0
- @ai-sdk/google: 3.0.43
- Node: v22.22.0
- pnpm: 10.29.3
- OS: Linux
```

### Screenshots

_No response_

### Logs & Errors

```shell
{
"type": "RUN_ERROR",
"message": "AI_APICallError: Function call is missing a thought_signature in functionCall parts. This is required for tools to work correctly, and missing thought_signature may lead to degraded model performance. Additional data, function call `default_api:get-current-date` , position 9. Please refer to https://ai.google.dev/gemini-api/docs/thought-signatures for more details.",
"code": "INCOMPLETE_STREAM"
}
```

### Additional Context

_No response_

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。