Skip to content

fix: include custom_providers in /model command listings and resolution#7088

Merged
teknium1 merged 2 commits into
mainfrom
hermes/hermes-617689ff
Apr 10, 2026
Merged

fix: include custom_providers in /model command listings and resolution#7088
teknium1 merged 2 commits into
mainfrom
hermes/hermes-617689ff

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

Salvage of PR #6807 by @rahimsais (commit by donrhmexe). Cherry-picked onto current main with follow-up fixes.

What this PR does: Custom providers defined under custom_providers: in config.yaml were invisible to the /model slash command in both CLI and gateway. You could configure a local LLM server but couldn't switch to it via /model.

Changes

Cherry-picked from #6807:

  • hermes_cli/providers.py — Add resolve_custom_provider() and extend resolve_provider_full() to check custom_providers
  • hermes_cli/model_switch.py — Propagate custom_providers through switch_model(), list_authenticated_providers(), get_authenticated_provider_slugs(); add custom provider section to listings with proper slug, name, and default model
  • gateway/run.py — Read custom_providers from config and pass to all model-switch calls
  • cli.py — Hoist config loading to read both providers and custom_providers; pass both to listing and switch calls
  • 4 new tests covering listing, resolution, switch, and gateway handler

Follow-up fixes:

  • Extract custom_provider_slug() helper in hermes_cli/providers.py — single source of truth for building custom:<name> slugs, replacing duplicated inline slug construction
  • Fix resolution bugresolve_custom_provider() had a logic error where canonical = normalize_provider(name) was added to every entry's comparison set, causing the first custom provider to always match any display name input. Fixed by removing the stale canonical from the comparison.
  • Harden gateway test — Added _session_model_overrides and _voice_mode to _make_runner() for object.__new__() safety

Test plan

  • All 4 new regression tests pass
  • 307 model-switch/providers tests pass (0 failures)
  • 1533 hermes_cli tests pass (4 pre-existing failures in unrelated test_env_loader.py)
  • 2346 gateway tests pass (13 pre-existing failures in unrelated areas)
  • 7/7 E2E tests: listing, slug resolution, display name resolution, negative case, slug consistency, switch_model, edge cases

Closes #6807

donrhmexe and others added 2 commits April 10, 2026 02:49
Custom providers defined in config.yaml under  were
completely invisible to the /model command in both gateway (Telegram,
Discord, etc.) and CLI. The provider listing skipped them and explicit
switching via --provider failed with "Unknown provider".

Root cause: gateway/run.py, cli.py, and model_switch.py only read the
 dict from config, ignoring  entirely.

Changes:
- providers.py: add resolve_custom_provider() and extend
  resolve_provider_full() to check custom_providers after user_providers
- model_switch.py: propagate custom_providers through switch_model(),
  list_authenticated_providers(), and get_authenticated_provider_slugs();
  add custom provider section to provider listings
- gateway/run.py: read custom_providers from config, pass to all
  model-switch calls
- cli.py: hoist config loading, pass custom_providers to listing and
  switch calls

Tests: 4 new regression tests covering listing, resolution, and gateway
command handler. All 71 tests pass.
- Add custom_provider_slug() to hermes_cli/providers.py as the single
  source of truth for building 'custom:<name>' slugs.
- Use it in resolve_custom_provider() and list_authenticated_providers()
  instead of duplicated inline slug construction.
- Add _session_model_overrides and _voice_mode to gateway test runner
  for object.__new__() safety.
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Supply Chain Risk Detected

This PR contains patterns commonly associated with supply chain attacks. This does not mean the PR is malicious — but these patterns require careful human review before merging.

⚠️ WARNING: exec() or eval() usage

Dynamic code execution can hide malicious behavior, especially when combined with base64 or network fetches.

Matches (first 20):

3032:+            self._sandbox.process.exec(f"mkdir -p {parent}")

⚠️ WARNING: Install hook files modified

These files can execute code during package installation or interpreter startup.

Files:

hermes_cli/setup.py
tests/hermes_cli/test_setup.py

Automated scan triggered by supply-chain-audit. If this is a false positive, a maintainer can approve after manual review.

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.

2 participants