Skip to content

fix(native-llm): replace hardcoded provider gate with shared support set - #38925

Open
mgajda wants to merge 1 commit into
anomalyco:devfrom
mgajda:fix/native-llm-gate
Open

fix(native-llm): replace hardcoded provider gate with shared support set#38925
mgajda wants to merge 1 commit into
anomalyco:devfrom
mgajda:fix/native-llm-gate

Conversation

@mgajda

@mgajda mgajda commented Jul 26, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #38893

Type of change

  • Bug fix

What does this PR do?

The native LLM runtime in packages/opencode/src/session/llm/native-runtime.ts has a hardcoded provider allowlist in statusWithFetch() that blocks Google, Amazon Bedrock, Azure, and OpenRouter from the native LLM path, even though packages/opencode/src/session/llm/native-request.ts has working adapters for them. These two lists are duplicated and drift apart when new providers are added.

Changes:

  • Export SUPPORTED_NPM_PACKAGES set from native-request.ts (single source of truth)
  • Use the shared set in the statusWithFetch() gate instead of hardcoded providerID/npm checks
  • Fix API key propagation: drop the provider.env.length === 1 guard that discarded discovered keys for providers with multiple env vars

How did you verify your code works?

  • TypeScript compiles in packages/llm, packages/core, packages/opencode
  • The SUPPORTED_NPM_PACKAGES set is verified to contain every package that native-request.ts routes
  • Native LLM now accepts all known provider packages

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Closes anomalyco#38893.

The native LLM runtime's statusWithFetch() had a hardcoded allowlist
of supported provider IDs and npm packages that excluded Google,
Amazon Bedrock, Azure, and OpenRouter from the native path, even
though native-request.ts had working adapters for them.

Export SUPPORTED_NPM_PACKAGES from native-request.ts and use it in
the gate so the two stay in sync by construction.

Also fix API key propagation for providers with multiple env vars
(GOOGLE_API_KEY, GOOGLE_GENERATIVE_AI_API_KEY, GEMINI_API_KEY)
by removing the env.length === 1 guard — the found key is now always
stored in provider.key.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Native LLM runtime hard-blocks Google/Gemini and other non-OpenAI providers

1 participant