Repository navigation
fix(den-api): reject duplicate model IDs on custom providers and deduplicate models.dev IDs case-insensitively - #7078
Open
sentry[bot] wants to merge 1 commit into
Open
sentry[bot] wants to merge 1 commit into
sentry[bot] wants to merge 1 commit into
Conversation
…plicate models.dev IDs case-insensitively
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub. 4 Skipped Deployments
|
Contributor
Warden: advisory — no major findingsNo high or medium security findings and no confidentiality findings. Warden does not block merging or grant or withdraw approvals. Tests and human review remain separate requirements. Reviewed |
This branch was previously deployed
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.
What is this about?
What problem does it solve?
Duplicate model IDs caused a unique constraint violation on
(llm_provider_id, model_id)(llm_provider_model_provider_model) during the batch insert. Duplicates included identical IDs in an array, several map keys with the same explicitid, and IDs that differed only by whitespace or case. The result was an unhandled 500.What was the situation before?
PATCH /v1/llm-providers/:llmProviderIddeletes existingllm_provider_modelrows and inserts new ones for each entry innormalized.models. Any duplicate in that list failed the insert.How is this implemented?
normalizeCustomProviderConfig(ee/apps/den-api/src/llm/custom-provider.ts) checks that all normalized model IDs are unique, ignoring case and whitespace. Duplicates throwCustomProviderConfigError.normalizeLlmProviderInput(ee/apps/den-api/src/routes/org/llm-providers.ts) catches that error and returns 400 Bad Request (invalid_custom_provider_config).normalizeLlmProviderInputalso deduplicatesmodelIdsformodels_devproviders, case-insensitively, keeping first occurrences.ee/apps/den-api/test/llm-provider-custom-config.test.tscover duplicate IDs in arrays, mapped configs, and case/whitespace variations.What else changed?
none
Release note
Updating an LLM provider with duplicate model IDs now returns a clear 400 error instead of a server error.
Evidence
PATCH /v1/llm-providers/:llmProviderId. After: the request returns 400invalid_custom_provider_config.llm-provider-custom-config.test.tsfor array duplicates, mapped configs, and case/whitespace variants.Fixes DEN-API-42
@sentry <feedback>: Autofix iterates on these changes@sentry stop iterating: Autofix stops iterating on this runThis PR was automatically generated by Sentry at no cost. You can adjust this setting at any time.