BUG: @ai-sdk/openai 2.0.50 breaks OpenAI OAuth plugin requiring store: false (missing providerOptions in compaction) #2059

Closed
opened 2026-02-16 17:33:59 -05:00 by yindo · 4 comments
Owner

Originally created by @numman-ali on GitHub (Oct 12, 2025).

Originally assigned to: @rekram1-node on GitHub.

Problem

AI SDK @ai-sdk/openai@2.0.50 (Oct 12, 2025) introduced item_reference usage that breaks plugins requiring store: false.

Error:
Item with id 'fc_xxx' not found. Items are not persisted when store is set to false.

Root Cause

Normal prompts work:
session/prompt.ts:276 passes providerOptions to streamText(), allowing config store: false to apply.

Compaction broken:
session/compaction.ts:125 calls generateText() WITHOUT providerOptions:

const generated = await generateText({
  maxRetries: 10,
  model: model.language,
  messages: [...]
  // Missing: providerOptions
})

Result: AI SDK defaults to store: true, creates item_reference items that can't resolve.

Fix

Options:

  1. Allow for specifying which version of packages to use
  2. Don't set version upgrades to latest for dependencies
  3. Let compaction take from provider options as prompt does

Add to session/compaction.ts:125:

  const generated = await generateText({
    maxRetries: 10,
    model: model.language,
    providerOptions: {
      [model.npm === "@ai-sdk/openai" ? "openai" : model.providerID]: model.info.options,
    },
    messages: [...]
  })

Workaround Tried

Force Downgrade to @ai-sdk/openai@2.0.49 (butwill be overwritten on plugin reload):

  cd ~/.cache/opencode
  echo '{"dependencies":{"opencode-copilot-auth":"0.0.3","opencode-anthropic-auth":"0.0.2","@ai-sdk/openai":"2.0.49"}}' > package.json
  rm -rf node_modules && npm install
Originally created by @numman-ali on GitHub (Oct 12, 2025). Originally assigned to: @rekram1-node on GitHub. ## Problem AI SDK `@ai-sdk/openai@2.0.50` (Oct 12, 2025) introduced `item_reference` usage that breaks plugins requiring `store: false`. **Error:** Item with id 'fc_xxx' not found. Items are not persisted when store is set to false. ## Root Cause **Normal prompts work:** `session/prompt.ts:276` passes `providerOptions` to `streamText()`, allowing config `store: false` to apply. **Compaction broken:** `session/compaction.ts:125` calls `generateText()` WITHOUT `providerOptions`: ```typescript const generated = await generateText({ maxRetries: 10, model: model.language, messages: [...] // Missing: providerOptions }) ``` Result: AI SDK defaults to store: true, creates item_reference items that can't resolve. **Fix** Options: 1. Allow for specifying which version of packages to use 2. Don't set version upgrades to latest for dependencies 3. Let compaction take from provider options as prompt does Add to session/compaction.ts:125: ```typescript const generated = await generateText({ maxRetries: 10, model: model.language, providerOptions: { [model.npm === "@ai-sdk/openai" ? "openai" : model.providerID]: model.info.options, }, messages: [...] }) ``` **Workaround Tried** Force Downgrade to @ai-sdk/openai@2.0.49 (butwill be overwritten on plugin reload): ```bash cd ~/.cache/opencode echo '{"dependencies":{"opencode-copilot-auth":"0.0.3","opencode-anthropic-auth":"0.0.2","@ai-sdk/openai":"2.0.49"}}' > package.json rm -rf node_modules && npm install ```
yindo closed this issue 2026-02-16 17:33:59 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Oct 12, 2025):

This issue might be a duplicate of existing issues. Please check:

  • #971: Model options are not forwarded for openai-compatible providers unless provider.name option is given

Both issues involve the same root cause: providerOptions not being properly forwarded in AI SDK calls. Issue #971 specifically mentions that @ai-sdk/openai-compatible searches for providerOptions based on the providerOptionsName attribute, which matches your analysis about missing providerOptions in compaction.ts.

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Oct 12, 2025): This issue might be a duplicate of existing issues. Please check: - #971: Model options are not forwarded for openai-compatible providers unless provider.name option is given Both issues involve the same root cause: providerOptions not being properly forwarded in AI SDK calls. Issue #971 specifically mentions that @ai-sdk/openai-compatible searches for providerOptions based on the providerOptionsName attribute, which matches your analysis about missing providerOptions in compaction.ts. Feel free to ignore if none of these address your specific case.
Author
Owner

@rekram1-node commented on GitHub (Oct 12, 2025):

should be easy fix

@rekram1-node commented on GitHub (Oct 12, 2025): should be easy fix
Author
Owner

@numman-ali commented on GitHub (Oct 13, 2025):

@rekram1-node thanks dude 🙏

@numman-ali commented on GitHub (Oct 13, 2025): @rekram1-node thanks dude 🙏
Author
Owner

@rekram1-node commented on GitHub (Oct 13, 2025):

shoudl be fixed in next release, lmk if not

@rekram1-node commented on GitHub (Oct 13, 2025): shoudl be fixed in next release, lmk if not
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#2059