Skip to content

fix(@ai-sdk/openai): omit reasoning item id when store is false#14983

Open
Mmartinrusso wants to merge 3 commits into
vercel:mainfrom
Mmartinrusso:fix/openai-omit-reasoning-id-when-store-false
Open

fix(@ai-sdk/openai): omit reasoning item id when store is false#14983
Mmartinrusso wants to merge 3 commits into
vercel:mainfrom
Mmartinrusso:fix/openai-omit-reasoning-id-when-store-false

Conversation

@Mmartinrusso
Copy link
Copy Markdown
Contributor

@Mmartinrusso Mmartinrusso commented May 5, 2026

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

  • All commits are signed (PRs with unsigned commits cannot be merged)
  • Tests have been added / updated (for bug fixes / features)
  • Documentation has been added / updated (for bug fixes / features)
  • A patch changeset for relevant packages has been added (for bug fixes / features - run `pnpm changeset` in the project root)
  • I have reviewed this pull request (self-review)

Related Issues

Fixes #12687

Mmartinrusso and others added 3 commits May 5, 2026 10:32
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@ai-sdk/openai: Reasoning items include id field when store: false, causing Azure rejection

1 participant