Skip to content

fix: Manual tool approvals reject inputs produced by Zod transforms - #21130

Open
ai-sdk-factory[bot] wants to merge 3 commits into
mainfrom
bugfix-21091-20260918081200643511
Open

ai-sdk-factory[bot] wants to merge 3 commits into
mainfrom
bugfix-21091-20260918081200643511

Conversation

@ai-sdk-factory

Copy link
Copy Markdown
Contributor

Background

Manual approval continuations in the published ai package rejected transformed tool inputs in both generateText and streamText, producing tool errors instead of executing approved tools.

Root Cause

parseToolCall stored the schema output in message history, while approval revalidation treated that transformed output as fresh schema input. The reproduction confirmed this by transforming a string to a number, then failing revalidation with zero tool executions.

Summary

Preserved the original schema input for transformed tool calls, then replayed schema validation and input refinement on continuation and verified that the result matched the approved input before execution.

Testing

Added Zod 3 and Zod 4 transform, object reshaping, refinement, tampering, and response-message persistence regression coverage.

End-to-end Validation

  • replay_original_reproduction — the immutable generateText and streamText reproduction exited successfully, and the original failure signal was absent.

Related Issues

Fixes #21091

Closes #21093

ai-sdk-factory and others added 3 commits September 18, 2026 11:48
Co-authored-by: brennanbutler01 <64561607+brennanbutler01@users.noreply.github.com>
Co-authored-by: brennanbutler01 <64561607+brennanbutler01@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Manual tool approval rejects SDK-generated inputs after Zod transforms

1 participant