Skip to content

fix: return informative message when model list is disabled for provider - #5895

Closed
gokul-scalent wants to merge 1 commit into
maximhq:devfrom
gokul-scalent:fix/issue-5774-model-list-disabled-message-v3
Closed

gokul-scalent wants to merge 1 commit into
maximhq:devfrom
gokul-scalent:fix/issue-5774-model-list-disabled-message-v3

Conversation

@gokul-scalent

Copy link
Copy Markdown

fix: respect list_models disabled setting in /v1/models fan-out

Summary

When a provider had list_models disabled via AllowedRequests, the GET /v1/models endpoint would still fan out to that provider and include its models in the response (or return an error). Two separate code paths were affected:

  1. Fan-out (no provider specified)GetConfiguredProviders() returned all providers regardless of their AllowedRequests config, causing disabled providers to be included in the aggregate model list.
  2. Single-provider queryGET /v1/models?provider=<name> did not check AllowedRequests before making the request, resulting in an unsupported_operation error being surfaced to the caller.

Changes

  • bifrost.goGetConfiguredProviders() now filters out providers where list_models is explicitly disabled in their CustomProviderConfig.AllowedRequests. Providers with no AllowedRequests config (i.e. all operations allowed) are unaffected.
  • models.go — Added an optional message field to BifrostListModelsResponse to convey informational messages (e.g. disabled notice) without breaking the response shape.
  • inference.go — Added a pre-flight check in listModels: if a specific provider is requested and its list_models is disabled, return an empty model list with a human-readable message ("The model_list request is disabled for this provider.") instead of forwarding the request.
  • bifrost_test.go and inference_list_models_test.go — Added unit tests covering both fan-out filtering and single-provider disabled behavior.

Type of change

  • Bug fix

Affected areas

  • Core (Go)
  • Transports (HTTP)

How to test

Describe the steps to validate this change. Include commands and expected outcomes.
image
image

Screenshots/Recordings

Previously, requests to providers with model_list disabled resulted in error logs. This change ensures those providers are excluded from model_list fan-out, eliminating the unnecessary errors.

image

Breaking changes

  • No

If yes, describe impact and migration instructions.

Related issues

Link related issues and discussions. Example: Closes #123

Security considerations

Note any security implications (auth, secrets, PII, sandboxing, etc.).

Checklist

  • I read docs/contributing/README.md and followed the guidelines
  • I added/updated tests where appropriate
  • I updated documentation where needed
  • I verified builds succeed (Go and UI)
  • I verified the CI pipeline passes locally if applicable

@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 639cd334-7781-42f5-9e61-ae143f7c6185

📥 Commits

Reviewing files that changed from the base of the PR and between ce1b2a6 and 5409536.

📒 Files selected for processing (2)
  • core/bifrost.go
  • core/bifrost_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • core/bifrost_test.go

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Provider listings now include only account-configured providers that initialize successfully.
    • Providers that do not allow model listing are excluded from available provider and model results.
    • Configuration lookup failures and unavailable runtime providers no longer cause listing operations to fail.

Walkthrough

GetConfiguredProviders now uses account configuration, permission checks, and initialized runtime instances. Model listing skips providers that fail preparation. Tests cover disabled model listing and failed provider initialization.

Changes

Provider model listing

Layer / File(s) Summary
Provider filtering and validation
core/bifrost.go, core/bifrost_test.go
GetConfiguredProviders filters blank, invalid, disallowed, and uninitialized providers. Configuration lookup failures are logged and skipped. Tests verify model-listing permissions and failed provider preparation behavior.

Estimated code review effort: 2 (Simple) | ~15 minutes

Mergeability Score: ⚪ Minimal · up to 54095

The change excludes providers with model listing disabled and returns an informative response for explicit provider requests; no actionable merge-blocking risk remains beyond normal checks and review.

Possibly related issues

  • #5774 — The changes exclude providers with AllowedRequests.ListModels disabled from model-listing operations.

Suggested reviewers: akshaydeo, pratham-mishra04, tejasghatte

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR changes /v1/models behavior, but linked issue #123 requires File API support such as POST /v1/files. Implement the File APIs required by issue #123, or link the PR to an issue that covers the /v1/models behavior.
Out of Scope Changes check ⚠️ Warning The /v1/models changes are unrelated to the linked issue #123, which only requests File API support. Move these changes to a related issue or update the linked issue to include the /v1/models list_models behavior.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the fix for disabled model listing, which is a primary part of the changes.
Description check ✅ Passed The description covers the purpose, changes, affected areas, screenshots, and tests, but the testing steps and checklist remain incomplete.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@CLAassistant

CLAassistant commented Aug 6, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@gokul-scalent
gokul-scalent marked this pull request as ready for review August 6, 2026 13:08

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@core/bifrost.go`:
- Around line 3605-3627: Update the model-provider collection around
GetConfiguredProviders and the modelProviders append to include only providers
that successfully completed initialization, reusing the existing
initialized-provider availability state or predicate. Preserve the current
config and operation-allowance filtering, and add a regression test covering a
prepareProvider failure so ListAllModels excludes that provider.

In `@transports/bifrost-http/handlers/inference_list_models_test.go`:
- Around line 100-105: Update TestBuildDisabledListModelsResponse to explicitly
assert that resp.Data is non-nil before asserting it is empty, ensuring the
response serializes data as an empty slice rather than null.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 533cb662-8817-480f-8e3f-65b19a281612

📥 Commits

Reviewing files that changed from the base of the PR and between 041817a and 2f8e7f0.

📒 Files selected for processing (5)
  • core/bifrost.go
  • core/bifrost_test.go
  • core/schemas/models.go
  • transports/bifrost-http/handlers/inference.go
  • transports/bifrost-http/handlers/inference_list_models_test.go

Comment thread core/bifrost.go
Comment thread transports/bifrost-http/handlers/inference_list_models_test.go Outdated
coderabbitai[bot]
coderabbitai Bot previously approved these changes Aug 13, 2026
@gokul-scalent
gokul-scalent force-pushed the fix/issue-5774-model-list-disabled-message-v3 branch from b90c437 to 5409536 Compare August 13, 2026 10:41
@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@gokul-scalent

Copy link
Copy Markdown
Author

New PR created for this

#6125

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.

Files API Support

2 participants