Repository navigation
fix(openai): include reasoning parts without itemId when encrypted_content is present - #12869
Merged
gr2m merged 1 commit intoFeb 26, 2026
Merged
Conversation
…resent When providerOptions.openai.itemId is absent on a reasoning content part, the converter previously skipped the part entirely with a warning: 'Non-OpenAI reasoning parts are not supported. Skipping reasoning part' This breaks multi-turn conversations for users who remove itemId to avoid 'Item with id ... not found' errors from the OpenAI Responses API. The OpenAI Responses API accepts reasoning items without an id as long as encrypted_content is supplied. With this fix: - If itemId is absent but reasoningEncryptedContent is present, a reasoning item is pushed with only encrypted_content (no id field). - If neither is present, the existing warning is still emitted. - Makes id optional in OpenAIResponsesReasoning type to reflect the API. Fixes vercel#12853
gr2m
approved these changes
Feb 26, 2026
gr2m
left a comment
Collaborator
There was a problem hiding this comment.
PR looks good and I confirmed the tests fail without the code changes.
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.
Summary
When
providerOptions.openai.itemIdis absent on a reasoning content part, theconvertToOpenAIResponsesInputconverter previously skipped the part entirely with:This breaks multi-turn conversations for users who remove
itemIdfrom their reasoning parts to avoidItem with id 'rs_...' not founderrors from the OpenAI Responses API.Root Cause
The
reasoningcase in the converter requiredproviderOptions.openai.itemIdto be present before including the reasoning in the request. When absent, it fell to the generic warning path — even whenreasoningEncryptedContentwas available.Fix
The OpenAI Responses API accepts reasoning items without an
idfield whenencrypted_contentis supplied. With this change:itemIdis absent butreasoningEncryptedContentis present → push a reasoning item with onlyencrypted_content(noid).idoptional onOpenAIResponsesReasoningtype to accurately reflect the API.Testing
Added two new test cases:
itemIdbut withencrypted_contentis included in outputitemIdorencrypted_contentstill warnsFixes #12853