fix(provider): filter empty text blocks for base_url providers#21190
fix(provider): filter empty text blocks for base_url providers#21190zongtingwei wants to merge 1 commit into
Conversation
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
The following comment was made by an LLM, it may be inaccurate: Based on my search, I found several related PRs that address similar empty content filtering issues: Potentially Related PRs:
Why these are related: PR #21190 addresses empty text block filtering in the shared normalization path for base_url providers routing to Bedrock. The PRs above have tackled similar issues with empty content filtering across different provider types and contexts. #17742 and #17396 appear most directly related as they address the same core issue of empty text block handling for similar provider scenarios. |
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
Issue for this PR
Closes #13811
Type of change
What does this PR do?
This fixes an empty-content filtering gap in
normalizeMessages().Right now empty text/reasoning blocks are only filtered for specific providers. When
base_urlis used with an OpenAI-compatible provider that routes to Bedrock, that path can still send empty text blocks and Bedrock rejects the request withmessages: text content blocks must be non-empty.This change moves the empty-content filtering into the shared normalization path so it also applies to OpenAI-compatible
base_urlsetups. It also adds regression tests for openai-compatible, anthropic, bedrock, and openai variants.How did you verify your code works?
I verified it with:
bun test test/provider/transform.test.tsResult: 120 pass
Screenshots / recordings
N/A, no UI changes.
Checklist