Skip to content

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

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

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

Conversation

@mgajda

@mgajda mgajda commented Jul 25, 2026

Copy link
Copy Markdown

Closes #38893.

The native LLM runtime at packages/opencode/src/session/llm/native-runtime.ts had a hardcoded allowlist in statusWithFetch() that blocked Google, Amazon Bedrock, Azure, and OpenRouter from the native LLM path, even though native-request.ts had working adapters for them.

The two lists were duplicated and had drifted apart as new providers were added.

Changes:

  • Export SUPPORTED_NPM_PACKAGES from native-request.ts (one source of truth)
  • Use the shared set in statusWithFetch() gate instead of hardcoded checks
  • Fix API key propagation: remove env.length === 1 guard that dropped keys for providers with multiple env vars (e.g. Google has GOOGLE_API_KEY, GOOGLE_GENERATIVE_AI_API_KEY, GEMINI_API_KEY)

Verification: the native LLM path now accepts any provider whose npm package is in SUPPORTED_NPM_PACKAGES. Adding a new provider only requires updating the set in native-request.ts.

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.
@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Jul 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.

Feel free to open a new pull request that follows our guidelines.

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Jul 25, 2026
@github-actions github-actions Bot closed this Jul 25, 2026
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