hermes - 💡(How to fix) Fix /kanban (gateway slash command) emits argparse garbage instead of help

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

The /kanban slash command in the gateway adapter (Telegram, Slack, etc.) and interactive CLI returns broken or unfriendly output for the most common help paths.

Error Message

  1. /kanban help returns literal string (usage error: 2) plus the same usage dump.
  2. /kanban --help returns literal string (usage error: 0) and nothing else — the help text is silently swallowed.
  3. Unknown action returns (usage error: 2) followed by the full tree.
  4. Subcommand help (/kanban show -h) silently returns (usage error: 0) with no help text.
  • SystemExit from --help/-h is caught and converted to (usage error: <exit code>), even when the exit code is 0 (the success path for help).
  • Unknown action returns a single-line usage error prefixed ⚠ /kanban usage error. PR follows. Captures both stdout and stderr around parse_args, distinguishes SystemExit(0) (help dump) from SystemExit(2) (error), rewrites prog strings on every leaf parser, adds an explicit curated short-help block, and adds 5 regression tests covering the help aliases, subcommand help, unknown-action, and missing-required-arg paths.

Root Cause

run_slash in hermes_cli/kanban.py builds a throwaway top-level parser (prog="/", dest _top), then wraps the real kanban parser inside it as if it were a subcommand. Knock-on effects:

  • argparse renders prog as / + subcommand name → usage: / kanban ….
  • SystemExit from --help/-h is caught and converted to (usage error: <exit code>), even when the exit code is 0 (the success path for help).
  • argparse writes help to stdout and errors to stderr, but run_slash only captures stderr at parse time. Help text is therefore lost.
  • Two unused locals (parser, sub) at the top of run_slash.

Fix Action

Fix

PR follows. Captures both stdout and stderr around parse_args, distinguishes SystemExit(0) (help dump) from SystemExit(2) (error), rewrites prog strings on every leaf parser, adds an explicit curated short-help block, and adds 5 regression tests covering the help aliases, subcommand help, unknown-action, and missing-required-arg paths.

Code Example

from hermes_cli.kanban import run_slash
print(run_slash(""))            # bare /kanban
print(run_slash("help"))        # /kanban help
print(run_slash("--help"))      # /kanban --help
print(run_slash("frobnicate"))  # unknown action
print(run_slash("show -h"))     # subcommand help
RAW_BUFFERClick to expand / collapse

Summary

The /kanban slash command in the gateway adapter (Telegram, Slack, etc.) and interactive CLI returns broken or unfriendly output for the most common help paths.

Repro

from hermes_cli.kanban import run_slash
print(run_slash(""))            # bare /kanban
print(run_slash("help"))        # /kanban help
print(run_slash("--help"))      # /kanban --help
print(run_slash("frobnicate"))  # unknown action
print(run_slash("show -h"))     # subcommand help

Observed

  1. Bare /kanban dumps the full ~3KB argparse usage tree. In a chat bubble this reads as visual garbage.
  2. /kanban help returns literal string (usage error: 2) plus the same usage dump.
  3. /kanban --help returns literal string (usage error: 0) and nothing else — the help text is silently swallowed.
  4. Unknown action returns (usage error: 2) followed by the full tree.
  5. Subcommand help (/kanban show -h) silently returns (usage error: 0) with no help text.
  6. Cosmetic usage lines read usage: / kanban … (stray space) and usage: /kanban kanban … (doubled kanban) because of how the parser is wrapped.

Root cause

run_slash in hermes_cli/kanban.py builds a throwaway top-level parser (prog="/", dest _top), then wraps the real kanban parser inside it as if it were a subcommand. Knock-on effects:

  • argparse renders prog as / + subcommand name → usage: / kanban ….
  • SystemExit from --help/-h is caught and converted to (usage error: <exit code>), even when the exit code is 0 (the success path for help).
  • argparse writes help to stdout and errors to stderr, but run_slash only captures stderr at parse time. Help text is therefore lost.
  • Two unused locals (parser, sub) at the top of run_slash.

Expected

  • Bare /kanban returns a curated short-help block (chat-friendly, lists common subcommands, points to /kanban <sub> -h for detail).
  • /kanban help, --help, -h, ? return the same curated short-help.
  • /kanban <sub> -h returns the subcommand's actual help text.
  • Unknown action returns a single-line usage error prefixed ⚠ /kanban usage error.
  • Usage strings consistently read /kanban and /kanban <sub> — no doubling, no stray space.

Affected surfaces

  • gateway/run.py::_handle_kanban_command (every chat platform)
  • cli.py::_handle_kanban_command (interactive CLI)

Fix

PR follows. Captures both stdout and stderr around parse_args, distinguishes SystemExit(0) (help dump) from SystemExit(2) (error), rewrites prog strings on every leaf parser, adds an explicit curated short-help block, and adds 5 regression tests covering the help aliases, subcommand help, unknown-action, and missing-required-arg paths.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING