fix: prevent unsigned reasoning replays from sending empty Bedrock assistant messages

Merged
AI
3mo ago
+44-1

Background

Replaying an aborted reasoning-only assistant turn caused Bedrock to receive content: [], return a non-retryable 400, and block subsequent conversation turns.

Root Cause

The Bedrock converter intentionally filtered unsigned reasoning but unconditionally appended its assistant message. The reproduction and failing regression request confirmed this produced an empty assistant content array.

Summary

The Bedrock converter now omits assistant messages left empty after content filtering. Reproduction-only artifacts were removed and a patch changeset was added.

Testing

Added converter regression coverage confirming a reasoning-only unsigned assistant turn is omitted while later user messages remain.

End-to-end Validation

  • pnpm -C examples/ai-functions exec tsx -e '<two replay live Bedrock script>' — both the original poisoned history and a subsequent user turn completed against Nova 2 Lite without the previous 400.

Related Issues

Fixes #18452

Closes #18454