Skip to content

Validate the evaluator's LLM provider selection - #3998

Merged
snopoke merged 1 commit into
mainfrom
sk/evaluator-provider-validation
Jul 29, 2026
Merged

snopoke merged 1 commit into
mainfrom
sk/evaluator-provider-validation

Conversation

@snopoke

@snopoke snopoke commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Product Description

Picking an LLM provider or model the team doesn't have access to, or a model that doesn't belong to the selected provider's type, is now rejected on save with a message naming the problem — instead of saving and failing later when the evaluator runs.

Technical Description

Evaluator.params is a JSON blob, so llm_provider_id and llm_provider_model_id never passed through a ModelChoiceField queryset. Nothing checked team ownership, and nothing checked that the model's provider type matched the provider. Both checks now run in EvaluatorForm.clean.

The team check is the one that matters: an id from another team would have run this team's evaluations against another team's credentials.

Also adds configure_evaluator_llm_provider next to EvaluatorFactory, which leaves the provider ids out of params and so builds an evaluator this validation rejects.

Migrations

None.

  • The migrations are backwards compatible

Demo

The picker only ever offers models matching the chosen provider's type, so the type error is reachable only by a hand-crafted post.

Docs and Changelog

  • This PR requires docs/changelog update

The ids arrive inside the params JSON blob, so they never passed through a
ModelChoiceField queryset: neither team ownership nor provider/model type
compatibility was checked.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@snopoke, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 59 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 78ced2df-e929-4288-9cef-d1ebbdbbecc5

📥 Commits

Reviewing files that changed from the base of the PR and between 4a9c6d9 and da55b1d.

📒 Files selected for processing (3)
  • apps/evaluations/forms.py
  • apps/evaluations/tests/test_evaluator_views.py
  • apps/utils/factories/evaluations.py

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.

@codescene-delta-analysis codescene-delta-analysis Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Gates Failed
Enforce advisory code health rules (1 file with Complex Conditional)

Our agent can fix these. Install it.

Gates Passed
3 Quality Gates Passed

Reason for failure
Enforce advisory code health rules Violations Code Health Impact
forms.py 1 advisory rule 4.69 → 4.56 Suppress

See analysis details in CodeScene

Quality Gate Profile: Clean Code Collective
Install CodeScene MCP: safeguard and uplift AI-generated code. Catch issues early with our IDE extension and CLI tool.

Comment thread apps/evaluations/forms.py
# The picker only offers models matching the chosen provider's type (see
# ``_evaluator_parameter_values``), so a mismatch means the ids were not submitted
# through the UI. Left unchecked it fails at run time inside get_llm_service.
if provider is not None and provider_model is not None and provider.type != provider_model.type:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

❌ New issue: Complex Conditional
EvaluatorForm._validate_llm_provider_selection has 1 complex conditionals with 2 branches, threshold = 2

Suppress

@snopoke
snopoke merged commit 2782f35 into main Jul 29, 2026
22 of 23 checks passed
@snopoke
snopoke deleted the sk/evaluator-provider-validation branch July 29, 2026 13:38
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.

1 participant