fix(providers): deduplicate custom providers — register both plain and prefixed slugs in seen_slugs#13114
Closed
bennytimz wants to merge 1 commit into
Closed
Conversation
…n 3 to prevent duplicate custom provider entries
Contributor
|
Merged via PR #13154 (#13154). Your fix was salvaged onto current main with co-authorship preserved. Thanks @bennytimz! |
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.
Fixes #12293.
In
list_providers(), Section 3 (user-defined endpoints) appends each provider toresultsbut never registers its slug inseen_slugs. Section 4 (saved custom providers) generates thecustom:-prefixed slug viacustom_provider_slug()and checksseen_slugsfor deduplication — but since the plainep_namewas never registered, the check never fires and the same provider is emitted twice in/model.Root cause
hermes_cli/model_switch.py, Section 3:Section 4 generates
custom:<name>viacustom_provider_slug(), checksseen_slugs, finds nothing, and emits a duplicate.Fix
After the
results.append()in Section 3, register both slug forms:This ensures Section 4's dedup check correctly suppresses the duplicate entry regardless of which slug format it generates.
custom_provider_slugis already imported at module level (line 28) — no new imports required.Test plan
~/.hermes/config.yamlthat also appears in the built-in registry cache/model— verify the provider appears exactly once