fix(@ai-sdk/openai): omit reasoning item id when store is false#14983
Open
Mmartinrusso wants to merge 3 commits into
Open
fix(@ai-sdk/openai): omit reasoning item id when store is false#14983Mmartinrusso wants to merge 3 commits into
Mmartinrusso wants to merge 3 commits into
Conversation
Azure OpenAI rejects reasoning items that include an id field in stateless mode (store: false). The id is only meaningful when the server persists items (store: true), where it is used to build item_reference pointers in subsequent turns. Strip id from the reasoning message object in the store: false branch and update the corresponding test expectations. Fixes vercel#12687
…hots Three toMatchInlineSnapshot assertions in the merging-and-sequencing test block still included id fields that the fix intentionally omits. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
7fbb7a0 to
f93e05c
Compare
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.
Background
When `store: false`, the SDK includes `id` in reasoning items sent to the API. Azure OpenAI rejects these requests with an error because the `id` field is only meaningful in store mode — in stateless mode it is an invalid field.
Fixes #12687.
Summary
Remove `id` from the reasoning object in the `store: false` branch of `convert-to-openai-responses-input.ts`. The field is already typed as optional (`id?: string`), so omitting it is type-safe and has no effect on direct OpenAI.
Manual Verification
Inspected serialized request body in the test suite: `id` is absent from reasoning items in the `store: false` path and present as expected in the `store: true` path.
Checklist
Related Issues
Fixes #12687