anomalyco / anomalyco/opencode

fix: provider hook skipped for non-catalog providers

Open
#38,839 1 comment 0 reactions 1 assignee View on GitHub

@jlongster is already working on this.

Since Jul 25, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Description

When a plugin registers a ProviderHook targeting a provider not in the models-dev catalog (e.g., cursor via opencode-cursor-oauth), the hook is silently skipped because database[providerID] is undefined at provider.ts:1375.

The catalog builder only iterates providers that already exist in the built-in catalog, so third-party plugins can never populate models for custom providers.

Steps to Reproduce

  1. Install opencode-cursor-oauth plugin
  2. Configure cursor provider in opencode.json
  3. Run opencode auth login --provider cursor
  4. Start opencode — cursor models do not appear in the model picker

Expected Behavior

Cursor models should appear in the model picker when the plugin is configured.

Actual Behavior

Cursor models are silently skipped because database["cursor"] is undefined.

Root Cause

In packages/opencode/src/provider/provider.ts:1375:

const provider = database[providerID]
if (!provider) continue

The database map is built from the models-dev catalog, which does not include third-party providers like cursor. The plugin hook is skipped before it can populate models.

Fix

Create a skeleton provider entry when database[providerID] is undefined, so the plugins models() function can populate it.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.