Skip to content

/model picker silently falls back to text list (TypeError swallowed in _handle_model_command) #20966

@leeftk

Description

@leeftk

Summary

On Telegram/Discord, running /model with no args is documented to show an interactive inline-keyboard picker, but it silently falls back to the text list instead. The picker code path raises a TypeError that's swallowed by a bare except Exception: providers = [].

Reproduction

  1. Telegram (or Discord) bot on hermes-agent v0.12.0
  2. In any chat, send /model with no arguments
  3. Expected: inline-keyboard provider/model picker
  4. Actual: plain text list of providers + "/model <name> — switch model" usage hint

Root cause

In gateway/run.py _handle_model_command calls:

providers = list_picker_providers(
    current_provider=current_provider,
    current_base_url=current_base_url,
    current_model=current_model,
    user_providers=user_provs,
    custom_providers=custom_provs,
    max_models=50,
)

But hermes_cli/model_switch.py:list_picker_providers does not accept current_base_url or current_model:

def list_picker_providers(
    current_provider: str = "",
    user_providers: dict = None,
    custom_providers: list | None = None,
    max_models: int = 8,
) -> List[dict]:

The call raises TypeError: list_picker_providers() got an unexpected keyword argument 'current_base_url'. That exception is caught by:

try:
    providers = list_picker_providers(...)
except Exception:
    providers = []

Empty providers then fails the if providers: guard and execution falls through to the text-list fallback. No log, no error to the user, picker just never appears.

Suggested fix

  1. Add the missing kwargs to list_picker_providers and forward them to the inner list_authenticated_providers call:
def list_picker_providers(
    current_provider: str = "",
    current_base_url: str = "",
    current_model: str = "",
    user_providers: dict = None,
    custom_providers: list | None = None,
    max_models: int = 8,
) -> List[dict]:
    ...
    providers = list_authenticated_providers(
        current_provider=current_provider,
        current_base_url=current_base_url,
        current_model=current_model,
        user_providers=user_providers,
        custom_providers=custom_providers,
        max_models=max_models,
    )
  1. Replace the bare except Exception: providers = [] in _handle_model_command with at least a logger.warning("list_picker_providers raised: %s", exc, exc_info=True) so future signature drift surfaces in logs.

Verified locally

Patched both files on a v0.12.0 install and the inline-keyboard picker appears as expected on Telegram. Happy to open a PR if useful.

Environment

  • hermes-agent v0.12.0 (2026-04-30)
  • Python 3.13.5
  • Platform: Telegram (also affects Discord — same code path)

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium — degraded but workaround existscomp/cliCLI entry point, hermes_cli/, setup wizardcomp/gatewayGateway runner, session dispatch, deliverytype/bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions