SIGN IN SIGN UP

fix: reject stale persisted tool inputs without blocking unparsed or unavailable-tool history (#19363)

## Background

Persisted tool calls can outlive their schemas or registrations and
contradict current UIMessage types, while unparsed error history and
terminal calls from unavailable ephemeral tools must remain safely
loadable.

## Root Cause

Terminal and approval states bypassed current tool-schema validation
after compatibility handling was broadened, including completed empty
inputs and parsed output-error inputs. Missing terminal tools could also
remain exposed under impossible static types. The immutable reproduction
and focused state-specific probes confirmed these gaps.

## Summary

Public validators now validate parsed typed inputs across approval and
terminal states, validate completed outputs, preserve output-error parts
whose input is absent, and convert missing terminal tools to dynamic
parts. Agent continuation and DirectChatTransport use the same
validation while also normalizing terminal history when agent tools are
omitted. An ai patch changeset documents the behavior.

## Testing

Regression coverage verifies stale non-empty and empty completed inputs,
stale output-error inputs, approval and denied states, output schemas,
unparsed error compatibility, public and agent missing-tool
normalization, createAgentUIStream, and DirectChatTransport. Focused
tests, AI package Node and Edge suites, full type checking,
formatting/linting, and package build pass.

## End-to-end Validation

- Immutable original reproduction — exited successfully without the bug
signal and was classified `no-longer-reproduces`.
- Built-package validation probe — rejected stale completed and
output-error inputs, preserved unparsed error history, and returned
unavailable terminal tools as dynamic parts.

## Related Issues

Fixes #19358

Closes #19360

---------

Co-authored-by: ai-sdk-factory <308175966+ai-sdk-factory@users.noreply.github.com>
Co-authored-by: dylanmoz <4955191+dylanmoz@users.noreply.github.com>
Co-authored-by: ai-sdk-factory[bot] <305873210+ai-sdk-factory[bot]@users.noreply.github.com>
Co-authored-by: Gregor Martynus <39992+gr2m@users.noreply.github.com>
Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
Co-authored-by: Aayush Kapoor <83492835+aayush-kapoor@users.noreply.github.com>
A
ai-sdk-factory[bot] committed
8dd86a903eaac6a8f7935c3e2be2f8a0cbf1808c
Parent: e6a2992
Committed by GitHub <noreply@github.com> on 8/26/2026, 10:19:39 PM