Skip to content

fix: show Snowflake Cortex in provider list before authentication#447

Merged
anandgupta42 merged 2 commits intomainfrom
fix/snowflake-cortex-provider-discovery
Mar 24, 2026
Merged

fix: show Snowflake Cortex in provider list before authentication#447
anandgupta42 merged 2 commits intomainfrom
fix/snowflake-cortex-provider-discovery

Conversation

@mdesmet
Copy link
Contributor

@mdesmet mdesmet commented Mar 24, 2026

Summary

  • Snowflake Cortex was invisible in the UI because it has no env var trigger (env: []) and is plugin-auth only — it only appeared after the user had already completed the auth flow, making it undiscoverable
  • Add Provider.all() to expose the full internal provider database (including unauthenticated custom providers)
  • Inject custom providers into GET /provider so Snowflake Cortex appears in the all list before auth, letting users find and authenticate it from the UI

Test plan

  • Provider.all() returns snowflake-cortex regardless of auth state
  • disabled_providers: ["snowflake-cortex"] suppresses it from the list
  • enabled_providers: ["anthropic"] suppresses it from the list
  • Provider.list() still returns nothing until authenticated (existing behaviour unchanged)
  • All 50 snowflake tests pass

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • New Features

    • Custom providers are now discoverable and displayed alongside standard providers in provider listings.
    • Added ability to retrieve all available providers from the system database.
    • Provider visibility can be controlled via enable/disable configuration filters.
  • Tests

    • Added verification tests for custom provider discoverability and configuration-based filtering.

Snowflake Cortex was invisible in the UI because it has no env var
trigger (env: []) and is plugin-auth only — it only appeared after the
user had already completed the auth flow, making it undiscoverable.

- Add Provider.all() to expose the full internal provider database
  (including unauthenticated custom providers like Snowflake Cortex)
- Inject custom providers into GET /provider so Snowflake Cortex appears
  in the UI before auth, letting users find and authenticate it
- Add tests: Provider.all() unauthenticated, disabled_providers and
  enabled_providers config filtering for custom providers

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link

@claude claude bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review to trigger a review.

Tip: disable this comment in your organization's Code Review settings.

@coderabbitai
Copy link

coderabbitai bot commented Mar 24, 2026

📝 Walkthrough

Walkthrough

The Provider namespace now exposes its internal database through a new database field in the state object and a new Provider.all() async function. The provider listing route was updated to discover and merge custom providers from the database, applying the same enable/disable filtering logic. New tests verify discoverability of unauthenticated custom providers and their filtering behavior.

Changes

Cohort / File(s) Summary
Provider State & Database Exposure
packages/opencode/src/provider/provider.ts
Extended state object with database field; added Provider.all() async function that retrieves the full provider database, enabling discovery of custom providers outside of authenticated contexts.
Provider Listing Route
packages/opencode/src/server/routes/provider.ts
Updated GET / endpoint to discover custom providers from Provider.all(), filter by enabled_providers and disabled_providers configuration, and merge into the response alongside ModelsDev and connected providers.
Provider Discovery & Filtering Tests
packages/opencode/test/provider/snowflake.test.ts
Added test suite verifying Provider.all() returns unauthenticated custom providers (snowflake-cortex with model details), validates filtering exclusion when disabled, and confirms omission when enabled_providers allowlist doesn't include the provider.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Suggested labels

contributor

Poem

🐰 A burrow of providers, once hidden away,
Now emerges through all(), in bold display!
Custom cortex finds sunlight, no auth required to gleam,
Filtered and merged with the rest of the team! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main objective: making Snowflake Cortex visible in the provider list before authentication.
Description check ✅ Passed The description covers all required template sections (Summary, Test Plan) with detailed explanations and includes a comprehensive checklist.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/snowflake-cortex-provider-discovery

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
packages/opencode/test/provider/snowflake.test.ts (1)

661-715: Test filtering logic differs slightly from route implementation.

The route uses filteredProviders (from ModelsDev) in its de-duplication check, but these tests only check against connected. Since snowflake-cortex isn't in ModelsDev anyway, this doesn't affect test correctness, but the comment "Simulate the route filtering" is slightly misleading.

Consider adding a comment noting this simplification:

         // Simulate route filtering with enabled_providers
-        // (snowflake-cortex is not in the enabled list, so it should be excluded)
+        // Simplified: only checks connected, not filteredProviders (from ModelsDev)
+        // since snowflake-cortex is a custom provider not in ModelsDev anyway
         const enabled = new Set(["anthropic"])
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/opencode/test/provider/snowflake.test.ts` around lines 661 - 715,
The test simulates route filtering but uses connected (from Provider.list())
instead of the route's de-duplication set filteredProviders (from ModelsDev);
update the test comments around Provider.all/Provider.list to explicitly state
this simplification and that filteredProviders is used in the actual route
de-duplication logic so readers know why the test uses connected rather than the
exact route implementation (refer to Provider.all, Provider.list, and
filteredProviders / ModelsDev in the comment).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@packages/opencode/test/provider/snowflake.test.ts`:
- Around line 661-715: The test simulates route filtering but uses connected
(from Provider.list()) instead of the route's de-duplication set
filteredProviders (from ModelsDev); update the test comments around
Provider.all/Provider.list to explicitly state this simplification and that
filteredProviders is used in the actual route de-duplication logic so readers
know why the test uses connected rather than the exact route implementation
(refer to Provider.all, Provider.list, and filteredProviders / ModelsDev in the
comment).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 954ffcfe-6b2f-4b7e-9664-23416255b488

📥 Commits

Reviewing files that changed from the base of the PR and between 12ed190 and bd9841e.

📒 Files selected for processing (3)
  • packages/opencode/src/provider/provider.ts
  • packages/opencode/src/server/routes/provider.ts
  • packages/opencode/test/provider/snowflake.test.ts

@anandgupta42 anandgupta42 merged commit cfe1bad into main Mar 24, 2026
10 checks passed
@anandgupta42 anandgupta42 deleted the fix/snowflake-cortex-provider-discovery branch March 25, 2026 02:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants