Skip to content

fix: skip empty-content assistant messages in Bedrock translator - #2191

Merged
nacx merged 3 commits into
envoyproxy:mainfrom
Killusions:fix/bedrock-empty-content
Jun 12, 2026
Merged

fix: skip empty-content assistant messages in Bedrock translator#2191
nacx merged 3 commits into
envoyproxy:mainfrom
Killusions:fix/bedrock-empty-content

Conversation

@Killusions

@Killusions Killusions commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Description

In the OpenAI-to-AWS-Bedrock message converter, Bedrock Converse rejects assistant messages with empty content arrays. Some clients send empty assistant messages. This skips them when they have no content blocks. Tool-call-only messages are preserved.

Fixes #2208

⚒️ with ❤️ by @siemens

@Killusions
Killusions requested a review from a team as a code owner June 3, 2026 22:01
@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Jun 3, 2026
@codecov-commenter

codecov-commenter commented Jun 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.72%. Comparing base (4a98a02) to head (bea8059).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2191   +/-   ##
=======================================
  Coverage   84.72%   84.72%           
=======================================
  Files         144      144           
  Lines       21171    21172    +1     
=======================================
+ Hits        17937    17938    +1     
  Misses       2152     2152           
  Partials     1082     1082           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread internal/translator/openai_awsbedrock.go
Signed-off-by: Linus Schlumberger <linus.schlumberger@siemens.com>
@Killusions
Killusions force-pushed the fix/bedrock-empty-content branch from b66742b to 52dd4e9 Compare June 11, 2026 13:54
@nacx
nacx enabled auto-merge (squash) June 11, 2026 14:58
@nacx

nacx commented Jun 12, 2026

Copy link
Copy Markdown
Member

/retest

@nacx
nacx merged commit 9a4b02c into envoyproxy:main Jun 12, 2026
55 of 57 checks passed
hustxiayang pushed a commit to hustxiayang/ai-gateway that referenced this pull request Jun 12, 2026
…oyproxy#2191)

**Description**

In the OpenAI-to-AWS-Bedrock message converter, Bedrock Converse rejects
assistant messages with empty content arrays. Some clients send empty
assistant messages. This skips them when they have no content blocks.
Tool-call-only messages are preserved.

Fixes envoyproxy#2208

Signed-off-by: Linus Schlumberger <linus.schlumberger@siemens.com>
Co-authored-by: Ignasi Barrera <ignasi@tetrate.io>
Signed-off-by: yxia216 <yxia216@bloomberg.net>
hustxiayang pushed a commit to hustxiayang/ai-gateway that referenced this pull request Jun 16, 2026
…oyproxy#2191)

**Description**

In the OpenAI-to-AWS-Bedrock message converter, Bedrock Converse rejects
assistant messages with empty content arrays. Some clients send empty
assistant messages. This skips them when they have no content blocks.
Tool-call-only messages are preserved.

Fixes envoyproxy#2208

Signed-off-by: Linus Schlumberger <linus.schlumberger@siemens.com>
Co-authored-by: Ignasi Barrera <ignasi@tetrate.io>
Signed-off-by: yxia216 <yxia216@bloomberg.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix: Empty assistant messages crash Bedrock translation

3 participants