Skip to content

fix(openai): omit reasoning item id when store is false#12952

Open
giulio-leone wants to merge 1 commit intovercel:mainfrom
giulio-leone:fix/openai-reasoning-id-store-false
Open

fix(openai): omit reasoning item id when store is false#12952
giulio-leone wants to merge 1 commit intovercel:mainfrom
giulio-leone:fix/openai-reasoning-id-store-false

Conversation

@giulio-leone
Copy link

Summary

Fixes #12687

Azure OpenAI rejects reasoning items that include an id field when store is disabled.

Root Cause

In convert-to-openai-responses-input.ts, the store: false branch for reasoning messages was creating objects with id: reasoningId:

reasoningMessages[reasoningId] = {
  type: 'reasoning',
  id: reasoningId,          // ← Azure rejects this when store=false
  encrypted_content: ...,
  summary: summaryParts,
};

The store: true branch correctly uses item_reference with id (line 384). But when store is false, the reasoning content should be sent inline without an id — the same pattern used for reasoning without an itemId (lines 450-454).

Fix

Remove id: reasoningId from the reasoning message object created in the store: false path. The reasoningId is still used as the local tracking key in reasoningMessages for deduplication, but it is not sent to the API.

594/594 OpenAI provider tests pass (2 consecutive clean runs).

@tigent tigent bot added ai/core core functions like generateText, streamText, etc. Provider utils, and provider spec. ai/provider related to a provider package. Must be assigned together with at least one `provider/*` label bug Something isn't working as documented provider/azure provider/openai labels Feb 28, 2026
@giulio-leone giulio-leone force-pushed the fix/openai-reasoning-id-store-false branch 2 times, most recently from d37411d to b286a36 Compare February 28, 2026 14:49
@giulio-leone
Copy link
Author

Intervention note for this PR:

Current blocker appears to be Vercel deployment authorization, not code/test correctness.

Observed pattern:

  • Vercel check fails with: "Authorization required to deploy."
  • Other checks (e.g., Socket Security / Vercel Agent Review) are passing.

Recommended unblock sequence:

  1. Complete the Vercel Git authorization flow from the failing check link.
  2. Re-run checks on this PR.
  3. If Vercel passes, this PR should move forward with normal review.

If useful, I can follow up with a PR-by-PR status sweep after authorization is completed.

@giulio-leone
Copy link
Author

This PR is ready for review — all CI checks pass, no merge conflicts, and all review threads have been resolved. Ready to merge when approved. 🚀

Azure OpenAI rejects reasoning items that include an id field when
store is disabled. The Responses API input converter was including
id: reasoningId in reasoning messages even in the store=false path.

Remove the id field from reasoning messages created in the store=false
branch so Azure endpoints accept the payload.

Fixes vercel#12687
@giulio-leone giulio-leone force-pushed the fix/openai-reasoning-id-store-false branch from b286a36 to ecc1933 Compare March 5, 2026 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai/core core functions like generateText, streamText, etc. Provider utils, and provider spec. ai/provider related to a provider package. Must be assigned together with at least one `provider/*` label bug Something isn't working as documented provider/azure provider/openai

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