Skip to content

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

Closed

Description

@numman-ali

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

Activity

  1. github-actions commented on Oct 13, 2025

    @github-actions
    Contributor

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

    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.

  2. self-assigned this
    on Oct 13, 2025
  3. rekram1-node commented on Oct 13, 2025

    @rekram1-node
    Collaborator

    should be easy fix

  4. numman-ali commented on Oct 13, 2025

    @numman-ali
    Author

    @rekram1-node thanks dude 🙏

  5. rekram1-node commented on Oct 13, 2025

    @rekram1-node
    Collaborator

    shoudl be fixed in next release, lmk if not

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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