Skip to content

fix(providers): deduplicate custom providers — register both plain and prefixed slugs in seen_slugs#13114

Closed
bennytimz wants to merge 1 commit into
NousResearch:mainfrom
bennytimz:fix/custom-provider-slug-dedup
Closed

fix(providers): deduplicate custom providers — register both plain and prefixed slugs in seen_slugs#13114
bennytimz wants to merge 1 commit into
NousResearch:mainfrom
bennytimz:fix/custom-provider-slug-dedup

Conversation

@bennytimz

Copy link
Copy Markdown
Contributor

Fixes #12293.

In list_providers(), Section 3 (user-defined endpoints) appends each provider to results but never registers its slug in seen_slugs. Section 4 (saved custom providers) generates the custom:-prefixed slug via custom_provider_slug() and checks seen_slugs for deduplication — but since the plain ep_name was never registered, the check never fires and the same provider is emitted twice in /model.

Root cause

hermes_cli/model_switch.py, Section 3:

results.append({
    "slug": ep_name,
    ...
})
# ep_name never added to seen_slugs — Section 4 can't dedup against it

Section 4 generates custom:<name> via custom_provider_slug(), checks seen_slugs, finds nothing, and emits a duplicate.

Fix

After the results.append() in Section 3, register both slug forms:

seen_slugs.add(ep_name)
seen_slugs.add(custom_provider_slug(display_name))

This ensures Section 4's dedup check correctly suppresses the duplicate entry regardless of which slug format it generates. custom_provider_slug is already imported at module level (line 28) — no new imports required.

Test plan

  • Define a custom provider in ~/.hermes/config.yaml that also appears in the built-in registry cache
  • Run /model — verify the provider appears exactly once
  • Verify providers that exist only in Section 3 or only in Section 4 still appear normally

…n 3 to prevent duplicate custom provider entries
@teknium1

Copy link
Copy Markdown
Contributor

Merged via PR #13154 (#13154). Your fix was salvaged onto current main with co-authorship preserved. Thanks @bennytimz!

@teknium1 teknium1 closed this Apr 20, 2026
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.

[Bug]: Duplicate custom providers not filtered — slug mismatch between custom_provider_slug() and seen_slugs

2 participants