Repository navigation
[Fix] Requests silently used a fallback model when the selected model was unknown - #2834
zoomote[bot] wants to merge 1 commit into
Conversation
|
Important Review skippedAuto reviews are limited based on label configuration. 🏷️ Required labels (at least one): 1
Please check the settings in the CodeRabbit UI or the
|
Review statusThis PR was opened by an automated account. A human maintainer must verify the change intent, provenance, and validation before merging. Current step: Mark the PR ready. Required CI must pass before CodeRabbit starts. Review-state labels are managed by this workflow; do not edit them manually. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Related GitHub Issue
Closes: #2831
Description
When the selected model ID was missing from a provider model registry, the request went out with the provider default model. Bedrock swapped the selected ID for its default model ID. Provider errors then pointed at a model the user never selected, and logs did not name the swap.
This PR stops the request before anything is sent when an explicitly selected model ID misses the registry. The error names the provider and the requested model ID. Requests now leave the client only with the model the user selected, or with the provider default when the user did not select a model.
Key choices:
assertModelResolvedwithUnresolvedModelIdError) lives insrc/api/providers/utils/model-resolution.ts. Each provider calls it at request time increateMessageandcompletePrompt.getModel()stays non-throwing, so display and cost paths keep working.apiModelIdthrew aTypeErrorin the constructor before this change.Test Procedure
New and updated unit tests:
src/api/providers/__tests__/bedrock-unresolved-model.spec.tscovers the registry miss on both request paths (the error names the provider and the requested ID, and no request is sent), the unselected default, the non-foundation-model ARN passthrough, the foundation-model ARN miss, a registered model, and an inference-profile prefixed ID.anthropic-vertex.spec.ts,minimax.spec.ts,openai-native.spec.ts, andopenai-codex.spec.tseach cover the reject path on both request entry points plus the accept paths (default resolution and a registered model sent unchanged).Validation:
pnpm testpasses from the repository root (20,840 tests passed, 39 skipped).pnpm run check-typespasses. ESLint passes on all touched files with no new suppressions.Recorded Stream (new provider only)
Not applicable. No new provider.
Pre-Submission Checklist
src/test-utils/,@/utils/test-utils) are used only for mechanical duplication; test intent and scenario-specific mocks remain visible.Visual Snapshots
Not applicable. The change alters request-time error behavior. No rendered surface changed.
Videos (interaction / animation only)
Not applicable. No interaction, animation, or rendered-state change.
Documentation Updates
Additional Notes
Reviewers may want to check these behavior decisions:
Get in Touch
0x7777777_
Related PRs