fix: validate routing models against discovery#1206
Open
guillaumegay13 wants to merge 3 commits intomnfst:mainfrom
Open
fix: validate routing models against discovery#1206guillaumegay13 wants to merge 3 commits intomnfst:mainfrom
guillaumegay13 wants to merge 3 commits intomnfst:mainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1206 +/- ##
=======================================
Coverage 98.48% 98.48%
=======================================
Files 94 94
Lines 7605 7605
Branches 2901 2901
=======================================
Hits 7490 7490
Misses 88 88
Partials 27 27
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
2 issues found across 4 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/backend/src/routing/routing.service.ts">
<violation number="1" location="packages/backend/src/routing/routing.service.ts:182">
P2: `removedModels` is collected from all `unsupported` records, but should only include models from providers in `removedProviders`. If a provider is still active via a different auth type, its models from the unsupported subscription record will be incorrectly flagged for tier-assignment removal.</violation>
</file>
<file name="packages/backend/src/routing/model-discovery/model-discovery.service.spec.ts">
<violation number="1" location="packages/backend/src/routing/model-discovery/model-discovery.service.spec.ts:884">
P2: The comment says subscription models "are still supplemented" but the assertion `toBeGreaterThanOrEqual(0)` is a tautology — it passes even when the result is empty (i.e., no supplementing occurred). If the intent is to verify fallback models are returned, use `toBeGreaterThan(0)` or assert on specific model IDs.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Collaborator
Author
|
@brunobuddy merge conflicts resolved. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary by cubic
Enforces that routing selections only use models discovered for the agent and removes pricing/prefix-based fallbacks. Improves cleanup on provider removal while preserving native-only picks when an API key remains. Related to #1203.
setOverride/setFallbacksagainst discovery; reject missing models withBadRequestException.getEffectiveModel: use the override only if it’s discovered; otherwise fall back to auto; remove pricing/provider-prefix heuristics.cached_models, and notify; keep native-only models if another active auth (e.g., API key) for the same provider remains.setFallbacks: de-duplicate inputs, exclude the current override, and return the cleaned list.Written for commit 7d0f40e. Summary will update on new commits.
Related to #1203