Skip to content

Backport: fix(google): emit no-args streaming tool calls and preserve thoughtSignature#15136

Merged
gr2m merged 2 commits into
release-v6.0from
backport-pr-14968-to-release-v6.0
May 8, 2026
Merged

Backport: fix(google): emit no-args streaming tool calls and preserve thoughtSignature#15136
gr2m merged 2 commits into
release-v6.0from
backport-pr-14968-to-release-v6.0

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot commented May 8, 2026

This is an automated backport of #14968 to the release-v6.0 branch. FYI @gr2m

…gnature (#14968)

## Background

Vertex emits a no-args function call as a single chunk shaped `{
functionCall: { name: 'X' } }` with no `args`, no `partialArgs`, and no
`willContinue`. The streaming parser in `google-language-model.ts`
classifies chunks into `isStreamingChunk` / `isTerminalChunk` /
`isCompleteCall`, and a no-args call matches none of them — so it falls
through and is silently dropped. The unary (`doGenerate`) path has the
same drop because of an `args != null` guard.

For Gemini 3 thinking models that one dropped chunk also carries the
response's `thoughtSignature`. Vertex enforces a multi-turn rule: an
assistant turn containing any function calls must contain at least one
with a `thoughtSignature`. When the dropped call is the first call (the
one with the sig), the next agent step 400s with `missing
thought_signature`.

## Summary

- Streaming path: add a fourth classifier `isNoArgsCompleteCall` that
matches `{ name: X }` with no `args` / `partialArgs` / `willContinue !==
true`, and emit `tool-input-start` → `tool-input-end` → `tool-call` with
`'{}'` input, propagating `providerMetadata` (so `thoughtSignature`
survives).
- Unary path: stop requiring `args != null`. Use `JSON.stringify(args ??
{})` so a no-args complete call from `doGenerate` is also emitted
instead of dropped.

## Manual Verification

See #14968 description

---

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: Rayan Salhab <cyphercodes@users.noreply.github.com>
Co-authored-by: Paul Elliot <paulelliotco@users.noreply.github.com>
@gr2m gr2m closed this May 8, 2026
auto-merge was automatically disabled May 8, 2026 18:50

Pull request was closed

@gr2m gr2m reopened this May 8, 2026
Fix CI failures on the backported #14968 test by:
- Renaming GoogleLanguageModel → GoogleGenerativeAILanguageModel (the
  v6.0 class name).
- Dropping the googleVertex providerMetadata key assertion. The
  dual-key (googleVertex + vertex) helper is a separate refactor that
  only exists on main; v6.0 emits a single vertex key.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@gr2m gr2m merged commit 59530cf into release-v6.0 May 8, 2026
17 checks passed
@gr2m gr2m deleted the backport-pr-14968-to-release-v6.0 branch May 8, 2026 20:03
@github-actions
Copy link
Copy Markdown
Contributor Author

github-actions Bot commented May 8, 2026

🚀 Published in:

Package Version
ai 6.0.177
@ai-sdk/angular 2.0.178
@ai-sdk/gateway 3.0.112
@ai-sdk/google 3.0.71
@ai-sdk/google-vertex 4.0.125
@ai-sdk/langchain 2.0.183
@ai-sdk/llamaindex 2.0.177
@ai-sdk/react 3.0.179
@ai-sdk/rsc 2.0.177
@ai-sdk/svelte 4.0.177
@ai-sdk/vue 3.0.177

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant