SIGN IN SIGN UP

fix: surface Google prompt-level safety blocks without candidates as content-filter (#19767)

## Background

Valid Google prompt-level safety blocks returned without candidates
caused generation to fail validation or finish as other, while image
generation surfaced an API error.

## Root Cause

The non-streaming response schema required candidates and response
conversion assumed a first candidate, while streaming returned before
reading promptFeedback when no candidate existed. Recorded responses and
the original reproduction confirmed both paths dropped the prompt-level
block.

## Summary

Allowed candidate-less Google responses, mapped
promptFeedback.blockReason to content-filter with preserved provider
metadata in generation and streaming, and allowed image generation to
reach NoImageGeneratedError. Added a patch changeset.

## Testing

Added language-model regression tests for non-streaming and streaming
prompt blocks and an image-model test verifying prompt feedback and
empty image results are preserved.

## End-to-end Validation

- `replay_original_reproduction` — the immutable reproduction exited
successfully; generation and streaming returned `content-filter` with
prompt feedback, and image generation returned
`AI_NoImageGeneratedError`.

## Related Issues

Fixes #19758

Closes #19761

---------

Co-authored-by: ai-sdk-factory <308175966+ai-sdk-factory@users.noreply.github.com>
Co-authored-by: alex-percy <276363725+alex-percy@users.noreply.github.com>
A
ai-sdk-factory[bot] committed
56d492f61652af7bad16f56ed33cf41924ef5496
Parent: 0379422
Committed by GitHub <noreply@github.com> on 8/26/2026, 10:57:37 PM