fix(provider): filter unreplayable Bedrock reasoning before caching
Issue for this PR
Closes #45620.
Alternative interim fix to #45621 for dev. The currently published 4.x SDK still emits assistant messages containing only cache points after filtering unsigned reasoning.
Type of change
- Bug fix
- New feature
- Refactor / code improvement
- Documentation
What does this PR do?
Tighten the existing Bedrock content filter to retain only reasoning the pinned SDK can replay: signature, redactedContent, or redactedData. Resolve stored provider-specific metadata as well as the SDK's bedrock namespace.
The SDK already discards unsigned reasoning. Removing it during normalization lets the existing empty-message filter drop reasoning-only messages before cache points are assigned. Text and tool calls survive, and both redacted payload forms remain intact. No new filtering pass, dependency bump, or V2 changes.
How did you verify your code works?
bun test test/provider/transform.test.ts --timeout 30000 --only-failures: 425 passed, including 14 new regressions.- Cached and uncached tests exercise the transform through AI SDK
generateTextand the pinned Bedrock provider, inspecting the final JSON through a synthetic fetch. No live Bedrock requests. - Tests also cover both redacted fields, signed empty reasoning, SDK/stored/custom provider namespaces, mixed text/tool content, and isolation from other providers.
- Changed-file typecheck passed using
bun typecheck --project <temporary-config>; the config extends the package tsconfig and includes both changed files plussrc/**/*.d.ts(and their transitive imports). Full-package typecheck attempts terminated on the host without diagnostic output, so a full-package pass is not claimed. - Formatting and
git diff --checkpassed.
Screenshots / recordings
Not a UI change.
Checklist
- I have tested my changes locally
- I have not included unrelated changes in this PR
Requested by: @neriousy (Filip via Slack)