Skip to content

[Bug]: RuntimeWarning “run_in_terminal... was never awaited” when confirming /clear or /new in CLI #23297

@ankushnarula

Description

@ankushnarula

Bug Description

After recent destructive slash confirmation UX changes, using /clear or /new in the interactive CLI shows the expected confirmation prompt, but then emits:
    RuntimeWarning: coroutine 'run_in_terminal.<locals>.run' was never awaited
    and logs:
    cli.py:12438 logger.warning("process_loop unhandled error (msg may be lost): %s", e)

The confirmation prompt appears intentional; the RuntimeWarning appears to be a regression in the CLI input path.

Steps to Reproduce

  1. Start interactive CLI: hermes
  2. Ensure confirmations are enabled:
    approvals.destructive_slash_confirm: true
  3. Run /clear (or /new)
  4. Confirmation prompt appears with choices [1]/[2]/[3]
  5. Choose 1 (Approve Once) or 2 (Always Approve)
  6. Observe RuntimeWarning:
    coroutine 'run_in_terminal..run' was never awaited

Expected Behavior

/clear and /new should complete (or cancel) without coroutine warnings or unhandled-error logs.

Actual Behavior

Prompt is shown, but CLI emits RuntimeWarning about unawaited coroutine via run_in_terminal path.

Affected Component

CLI (interactive chat)

Messaging Platform (if gateway-related)

N/A (CLI only)

Debug Report

Report       https://paste.rs/wO2TT
agent.log    https://paste.rs/7zuVL
gateway.log  https://paste.rs/cB3qY

Operating System

Ubuntu 26.0.4

Python Version

3.11.15

Hermes Version

Hermes Agent v0.13.0 (2026.5.7)

Additional Logs / Traceback (optional)

/home/username/.hermes/hermes-agent/cli.py:12438: RuntimeWarning: coroutine 'run_in_terminal.<locals>.run' was never awaited

logger.warning("process_loop unhandled error (msg may be lost): %s", e)
    RuntimeWarning: Enable tracemalloc to get the object allocation traceback

Root Cause Analysis (optional)

Likely mismatch with prompt_toolkit API contract in current dependency:

  • prompt_toolkit 3.0.52 run_in_terminal(...) -> Awaitable[_T]
  • cli.py _prompt_text_input currently calls run_in_terminal(_ask) without await.
  • /clear and /new now route through _confirm_destructive_slash (commit b9c0011...), which calls _prompt_text_input, making this path frequent.

Relevant code/commits:

Proposed Fix (optional)

Update CLI call sites to handle run_in_terminal as awaitable in prompt_toolkit>=3.0.52 (especially _prompt_text_input and _run_curses_picker, plus other run_in_terminal call sites).

Temporary Workaround

From CLI...

hermes config set approvals.destructive_slash_confirm false

Are you willing to submit a PR for this?

  • I'd like to fix this myself and submit a PR

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