Skip to content

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

@numman-ali

Description

@numman-ali

Problem

AI SDK @ai-sdk/[email protected] (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/[email protected] (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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions