fix(openai): fix Responses API 400 errors for reasoning, tool calls, and ID handling (#11785)
* fix(openai): fix Responses API 400 errors for reasoning, tool calls, and ID handling Three categories of OpenAI Responses API 400 errors are addressed: 1. "No tool call found for function call output with call_id" — function_call items are now always emitted when tool calls exist (even without fc_ IDs), and orphaned function_call_output items are removed in post-processing. 2. "Item provided without its required 'reasoning' item" — reasoning items without encrypted_content (e.g. from saved sessions) are removed, and the id is stripped from subsequent function_call items so the API doesn't reject them for referencing a missing reasoning item. Trailing reasoning items not followed by a valid successor are also removed. 3. "Expected an ID that begins with 'fc'" — responsesOutputItemIds (which accumulates both msg_ and fc_ IDs during streaming) is now filtered to only fc_-prefixed IDs for function_call items, preventing msg_ IDs from being used where fc_ IDs are required. Co-authored-by: Luna <20552038+xxsLuna@users.noreply.github.com> Co-authored-by: Robert Benko <10097827+Quazistax@users.noreply.github.com> Co-authored-by: pallaprolus <162944051+pallaprolus@users.noreply.github.com> * fix(openai-adapters): don't duplicate tool call args in Vercel stream converter The tool-call event was re-emitting the full arguments that were already streamed via tool-input-start/delta, causing JSON.parse failures in consumers. Now tool-call only emits extra_content when a Gemini thoughtSignature is present, and returns null otherwise. --------- Co-authored-by: Luna <20552038+xxsLuna@users.noreply.github.com> Co-authored-by: Robert Benko <10097827+Quazistax@users.noreply.github.com> Co-authored-by: pallaprolus <162944051+pallaprolus@users.noreply.github.com>
D
Dallin Romney committed
02525d119b1a150e04428ec565e9626b0ebafb36
Parent: fd559bb
Committed by GitHub <noreply@github.com>
on 3/25/2026, 1:55:06 AM