Repository navigation
Conversation
|
The following comment was made by an LLM, it may be inaccurate: |
There was a problem hiding this comment.
Looks good to me. I ran the new test against the base code, where it fails (both empty assistant turns reach the outgoing prompt), and it passes with this change. The aisdk, aisdk-native and session-runner* suites pass, and the packages/core type check is clean.
The filter matches what the session layer's meaningful filter in to-llm-message.ts already does: it drops empty text parts even when they carry provider metadata. Reasoning-only turns are still sent, so signed reasoning still replays. A turn that gets dropped has no tool calls, so the worst case is two user messages in a row, and the AI SDK converters handle that.
The public API is unchanged.
No blocking concerns.
Related: #46881
|
Validation of this branch against real Bedrock: about 45 standalone runs, one tiny prompt per Default route ( Mantle override (
Items hit during validation, all pre-existing on dev, none blocking this PR (glad to file
cc @kitlangton |
7e5f715 to
9d20b21
Compare
9d20b21 to
1c727fc
Compare
Issue for this PR
Closes #23260
The remaining half of #23260 that the 2.0 rewrite did not absorb: the AI SDK route still emits assistant turns with no provider-visible content (
content: [], or only empty text fragments), which strict openai-compatible providers (DeepSeek, Kimi, LiteLLM-fronted Bedrock) reject with a 400. V2'stoLLMMessagesalready filters these at the session layer, but the wire boundary itself kept only the tool-message guard, so anything that does not go throughtoLLMMessagescan still forward one.Type of change
What does this PR do?
In
prompt()(packages/core/src/aisdk.ts) the mapped assistant content drops empty text fragments, and if nothing provider-visible remains the turn is not emitted. This mirrors the guard that already turns empty tool messages into no output. Reasoning parts are untouched, so signed Anthropic thinking blocks and Gemini thought signatures still replay; this also matches the session-layermeaningfulfilter, which already discards empty text parts.How did you verify your code works?
New test in
test/aisdk.test.ts:compileRequestwith an empty assistant turn and an empty-text-only turn; both were reaching the wire prompt before this change and do not after (the test failed against plain dev, which is how I confirmed the gap is still there).bun run checkpasses, as do the conversion-related suites locally: aisdk, aisdk-native, session-runner, session-runner-message, session-model-request(+hooks), session-provider-context, on session-compaction(&transport/native), session/generate.Screenshots / recordings
N/A.
Checklist
Added by the opencode bot (AI-generated).
Related: #46881