Skip to content

fix(cli): RuntimeWarning in /new, /clear, /undo, /reload-mcp — coroutine was never awaited #22970

@CalmProton

Description

@CalmProton

Bug Description

Running /new, /clear, /undo, or /reload-mcp mid-turn produces a RuntimeWarning:

RuntimeWarning: coroutine 'run_in_terminal.<locals>.run' was never awaited

The command still works (the confirmation prompt appears and input is accepted), but the warning is logged and the stack trace clutters output.

Steps to Reproduce

  1. Send a message that triggers a multi-turn agent run (e.g. "run a long build")
  2. While the spinner is active, type /new
  3. Observe the confirmation prompt
  4. After selecting a choice, the RuntimeWarning appears in logs

Root Cause

_prompt_text_input() in cli.py calls run_in_terminal(_ask) without checking whether it's on the main thread. The sibling method _run_curses_picker() already has a threading.current_thread() is threading.main_thread() guard and falls back to a direct call when on a background thread.

When slash commands are dispatched from process_loop (which runs in a background thread), run_in_terminal returns a coroutine that can't be scheduled on the main event loop, producing the warning.

Affected Commands

All destructive slash commands that use _confirm_destructive_slash()_prompt_text_input():

  • /new (and /reset)
  • /clear
  • /undo

Also /reload-mcp which uses _confirm_and_reload_mcp()_prompt_text_input().

Environment

  • Hermes version: main branch (May 2026)
  • OS: Linux (WSL2 on Windows 11)
  • Python: 3.11+

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low — cosmetic, nice to havecomp/cliCLI entry point, hermes_cli/, setup wizardtype/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