Skip to content

fix(cli): guard quick_commands against non-dict values#18850

Open
shellybotmoyer wants to merge 1 commit into
NousResearch:mainfrom
shellybotmoyer:fix/quick-commands-type-guard
Open

fix(cli): guard quick_commands against non-dict values#18850
shellybotmoyer wants to merge 1 commit into
NousResearch:mainfrom
shellybotmoyer:fix/quick-commands-type-guard

Conversation

@shellybotmoyer

Copy link
Copy Markdown
Contributor

Fix: Guard quick_commands against non-dict values

Problem

cli.py:6584 calls qcmd.get("type") on whatever value is in quick_commands — no validation that it's actually a dict. If a user has a string, int, or null value in their quick_commands config, all slash commands matching that key crash with AttributeError: 'str' object has no attribute 'get'.

Even worse, a broken quick_commands entry poisons any overlapping skill command, because quick_commands is checked BEFORE skill commands in the dispatch chain.

Reproduction

# ~/.hermes/config.yaml
quick_commands:
  foo: ''  # string instead of dict

Then /fooError: 'str' object has no attribute 'get'

Fix

Added isinstance(qcmd, dict) guard before accessing dict methods, matching the pattern already used in gateway/run.py:5214-5215. If the value is not a dict, we log a warning and fall through to plugin/skill command dispatch instead of crashing.

Testing

  • Verified the fix applies cleanly on top of current origin/main
  • The gateway already has this guard (lines 5214-5215), so this brings CLI parity with gateway

Fixes #18816

Without isinstance check, string/int values in quick_commands crash slash command dispatch with AttributeError.

Fixes NousResearch#18816
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/cli CLI entry point, hermes_cli/, setup wizard duplicate This issue or pull request already exists labels May 2, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Likely duplicate of #18817 — same root cause and fix for quick_commands non-dict guard in cli.py.

@alt-glitch

Copy link
Copy Markdown
Collaborator

Likely duplicate of #18817 - same root cause and fix for quick_commands non-dict guard in cli.py.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard duplicate This issue or pull request already exists P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

quick_commands with non-dict values crashes slash command dispatch

2 participants