Repository navigation
fix(ai): drop blank text from Bedrock error tool results - #463
Merged
Merged
Conversation
Blank tool text, error values, and content items now match an empty string. Anthropic success tool results drop that text and keep non-blank text unchanged.
PR 461 landed on the base while this branch was open. Keep that error-result filter and the whitespace-only success path from this branch. # Conflicts: # packages/ai/src/protocols/anthropic-messages.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
No tracked issue.
Type of change
What does this PR do?
This stacks on #462 (
cursor/blank-tool-text-24cd). Do not merge it ahead of that pull request. The diff againstintegration-v2includes #462 until that lands.Bedrock's error tool-result path skips blank rich text.
normalizeToolResultmarks a substituted blank error withempty: true, and Bedrock drops that placeholder only when other blocks remain. A real error whose text is exactly(no tool output)is kept when media is present.Claude and Nova reject image and document blocks inside an error tool result. For those models, error media is replaced with
[image omitted],[document omitted], or[file omitted]. Other Bedrock models still lower the image and hoist it beside the result.Head
fc26199b23.How did you verify your code works?
env -u RECORD CI=true bun test --timeout 30000inpackages/aion this head: 1966 pass, 28 skip, 0 fail. The skips are recorded cases whose cassettes are not on disk. Recorded fixtures that have cassettes passed.Visual
No UI change.
Screenshots / recordings
None.
Checklist