fix(opencode): avoid provider ID collision with OpenCode built-in loaders - #2520
Conversation
…ders The OpenAI Compatible extension sets llmMetadata.name to "openai", which was used directly as the provider key in the generated opencode.json. OpenCode's built-in "openai" loader unconditionally calls sdk.responses(), which is unsupported by @ai-sdk/openai-compatible, causing a TypeError. Suffix colliding IDs to "openai-compat" to bypass the built-in loader. Closes openkaiden#2519 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Marcel Bertagnini <mbertagn@redhat.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
📜 Recent review details⏰ Context from checks skipped due to timeout. (10)
🧰 Additional context used📓 Path-based instructions (4)**/*.{ts,tsx,js,jsx}📄 CodeRabbit inference engine (AGENTS.md)
Files:
**/*.spec.{ts,tsx,js,jsx}📄 CodeRabbit inference engine (AGENTS.md)
Files:
extensions/*/src/**/*.{ts,tsx}📄 CodeRabbit inference engine (AGENTS.md)
Files:
extensions/*/src/extension.ts📄 CodeRabbit inference engine (AGENTS.md)
Files:
🧠 Learnings (7)📚 Learning: 2026-05-05T17:30:20.418ZApplied to files:
📚 Learning: 2026-05-05T17:44:50.991ZApplied to files:
📚 Learning: 2026-05-12T10:01:14.248ZApplied to files:
📚 Learning: 2026-05-12T17:14:02.153ZApplied to files:
📚 Learning: 2026-06-29T13:16:53.102ZApplied to files:
📚 Learning: 2026-05-06T11:15:56.238ZApplied to files:
📚 Learning: 2026-06-18T08:20:05.553ZApplied to files:
🔇 Additional comments (2)
📝 WalkthroughWalkthroughOpenCode custom-endpoint handling now avoids provider-ID collisions by deriving an ChangesOpenCode provider compatibility
Possibly related issues
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
TypeError: sdk.responses is not a functionwhen using the OpenAI Compatible provider with OpenCode agent workspaces"openai-compat"when the configured npm package is@ai-sdk/openai-compatibleand the ID would collide with OpenCode's built-in loaders (openai,azure,azure-cognitive-services)Problem
OpenCode has built-in custom loaders for specific provider IDs (e.g.
"openai") that unconditionally callsdk.responses(modelID). When a user connects via Kaiden's "OpenAI Compatible" extension (LiteMaaS, vLLM, etc.),llmMetadata.nameis"openai", which was used directly as the provider key in the generatedopencode.json. Since the SDK package@ai-sdk/openai-compatibledoes not expose.responses(), the workspace crashes immediately on start.Fix
The extension now detects when the provider ID would collide with a built-in loader and suffixes it to
"openai-compat". This bypasses the built-in loader, causing OpenCode to usesdk.languageModel()instead — which works correctly with@ai-sdk/openai-compatible.Test plan
sdk.responseserrorCloses #2519