fix(app-bundle): drop messages with empty content array before API dispatch - #1218
Merged
Merged
Conversation
…spatch Anthropic/Bedrock APIs reject messages whose content field is an empty array. The provider-specific filters in normalizeMessages (Anthropic at L166, Bedrock at L196) catch most cases, but edge cases slip through — reasoning- only assistant turns whose parts are all stripped, cross-provider history replay where signature keys mismatch (anthropic vs bedrock providerOptions), or the interleaved-reasoning code path that returns early after filtering. Add a provider-agnostic final guard at the end of the message() export that drops any message with content: [] before it reaches the SDK. This is the last transform before the return, so it catches every upstream path at once. Surfaced by Opus 4.8 on Bedrock, which produces reasoning-heavy message patterns that the existing Bedrock filter's signature check did not retain. The upstream gap exists in the pinned base (7fe99387); this overlay patch is the minimal defensive fix. Verification: transform 407/407 (incl. 5 new), extension 3572/3572 green; build:binary compiles and smoke test passes; manifest hashes updated.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This was referenced Sep 16, 2026
jeonghun-jj-lee
added a commit
that referenced
this pull request
Sep 16, 2026
…he wave-2 merge (#1236) The wave-2 back-merge of main into dev (dfe3fbe) hand-ported the 568306f reasoning->text conversion but dropped the separate #1218 final guard from provider/transform.ts: msgs = msgs.filter((msg) => !Array.isArray(msg.content) || msg.content.length > 0) This is the last line of defense against a message with content: [] reaching a provider SDK/API — the class of Bedrock session-wedge #1218 closed. dev kept main's transform.test.ts (the 'final empty content guard' describe block still asserts empty-content messages are dropped), so the implementation and its tests were out of sync on dev. The overlay's bun tests aren't run by any CI job (build-binary compiles the overlay but doesn't test it; 'fast' is the extension vitest), so the regression was silent — dev is CI-green with the guard gone. Restores the guard verbatim from main: transform.ts is now byte-identical to origin/main except Aaron's wave-2 provenance comment. manifest.json updated surgically (the single transform.ts content hash); drift_gate.mjs PASS. Co-authored-by: amicode-ci <ci@amicode.local>
This was referenced Sep 16, 2026
jack-champagne
added a commit
that referenced
this pull request
Sep 16, 2026
fix(engine): port the #1218 empty-content guard onto main (currently only on dev)
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.
Problem
Anthropic/Bedrock APIs reject messages whose
contentfield is an empty array:Surfaced by Opus 4.8 on Bedrock, which produces reasoning-heavy message patterns that the existing provider-specific filters don't fully retain.
Root cause
The empty-content filters in
normalizeMessages(Anthropic at L166, Bedrock at L196) catch most cases, but edge cases slip through:anthropicvsbedrockproviderOptions)The gap exists in the upstream opencode base (
7fe99387); no Amicode commit introduced it.Fix
A provider-agnostic final guard at the end of
message()intransform.ts— the last transform before the return — that drops any message withcontent: []:One line, catches every upstream path at once.
Verification