Repository navigation
Description
Bug Description
Version: 0.13.0
Platform: Linux
The destructive-slash confirmation prompt added to cli.py (_confirm_destructive_slash, around line 8362) renders correctly but its input intercept never fires. Typing the answer (1, 2, or 3) sends that character to the agent as a chat message instead of resolving the prompt.
Steps to Reproduce
- Start Hermes CLI in TUI mode (hermes chat).
- Type /clear (or /new, /reset, /undo).
- Confirmation prompt prints:
⚠ /clear — destroys conversation state
This clears the screen and starts a new session.
The current conversation history will be discarded.
[1] Approve Once — proceed this time only
[2] Always Approve — proceed and silence this prompt permanently
[3] Cancel — keep current conversation
- Type 2 and press Enter.
Expected Behavior
prompt resolves, "Always Approve" path runs, approvals.destructive_slash_confirm is persisted to false.
Actual Behavior
the 2 is delivered to the agent as a user message ("2"). The prompt remains unresolved. The destructive command never runs and never cancels — it's just abandoned.
Affected Component
CLI (interactive chat)
Messaging Platform (if gateway-related)
No response
Debug Report
N/A, contains identifiable personal information due to machine setupOperating System
Pop!OS 24.04
Python Version
3.11.15
Hermes Version
0.13.0
Additional Logs / Traceback (optional)
Root Cause Analysis (optional)
Most likely cause:
_prompt_text_input (cli.py:5860) calls Python's built-in input() from inside prompt_toolkit.application.run_in_terminal:
def _prompt_text_input(self, prompt_text: str) -> str | None:
result = [None]
def _ask():
try:
result[0] = input(prompt_text).strip() or None
except (KeyboardInterrupt, EOFError):
pass
if self._app:
from prompt_toolkit.application import run_in_terminal
was_visible = self._status_bar_visible
self._status_bar_visible = False
self._app.invalidate()
try:
run_in_terminal(_ask)
finally:
self._status_bar_visible = was_visible
self._app.invalidate()
else:
_ask()
return result[0]
When the TUI Application is active, run_in_terminal is supposed to suspend the app's screen and hand stdin back to the wrapped callable. In this code path that handoff doesn't appear to happen — the prompt prints, but keystrokes continue to be consumed by prompt_toolkit's main input handler and end up in _pending_input, which process_loop then forwards to the agent as a normal user message. The result [None] is never populated, the prompt returns None, and _confirm_destructive_slash treats that as "cancelled (no input)", except the cancel message is also never printed because the function is sitting on input() that will never return.
May be related — same session as a broken-prompt repro shows these in ~/.hermes/logs/errors.log:
WARNING cli: process_loop unhandled error (msg may be lost):
There is no current event loop in thread 'Thread-3 (process_loop)'.
process_loop is the thread that drains _pending_input, so an asyncio-context bug there could plausibly interfere with run_in_terminal's stdin handoff. Not confirmed, just a correlation worth checking.
Proposed Fix (optional)
Replace the built-in input() in _prompt_text_input with prompt_toolkit's native prompt(), which cooperates with the active Application instead of competing for stdin:
def _prompt_text_input(self, prompt_text: str) -> str | None:
if self._app:
from prompt_toolkit.application import run_in_terminal
from prompt_toolkit.shortcuts import prompt as pt_prompt
result = [None]
def _ask():
try:
raw = pt_prompt(prompt_text)
result[0] = raw.strip() or None
except (KeyboardInterrupt, EOFError):
pass
was_visible = self._status_bar_visible
self._status_bar_visible = False
self._app.invalidate()
try:
run_in_terminal(_ask)
finally:
self._status_bar_visible = was_visible
self._app.invalidate()
return result[0]
# Non-TUI fallback unchanged
try:
return input(prompt_text).strip() or None
except (KeyboardInterrupt, EOFError):
return None
A more invasive but cleaner alternative: render the choice as a prompt_toolkit modal, similar to the /model picker at cli.py:5884 (_open_model_picker). That reuses the existing input-capture machinery and gets you arrow-key navigation for free, but it's a bigger change.
Workaround for affected users
Add to ~/.hermes/config.yaml:
approvals:
destructive_slash_confirm: false
This bypasses the prompt entirely (cli.py:8391–8392). Confirmed working on 0.13.0.
Are you willing to submit a PR for this?
- I'd like to fix this myself and submit a PR
Activity
misterjice commentedon May 10, 2026
I'm having the same problem. Looks like we have a commit though; any idea when it will go live?
shermanwsmith commentedon May 10, 2026
if you want a workaround, use this:
Place it in your config.yaml and it'll bypass that authentication pop until a fix is released.
fix(cli): use prompt_toolkit.prompt() for TUI confirmation prompts (F…
SoumyadeepDas commentedon May 12, 2026
Additional reproduction path: dangerous command permission prompt during delegate_task
Same root cause as described here, but triggered differently.
Setup: Main agent using
delegate_taskto spawn subagents in amulti-agent pipeline (Hermes 0.10.0, Linux).
What happens: When a subagent encounters a dangerous command and
triggers the permission prompt (Allow Once / Always Allow / Deny),
the entire CLI freezes completely — not just the prompt, but all
input. Nothing is accepted. The session has to be killed manually.
This is broader than
/newand/clear. Any dangerous commandpermission prompt raised from a subagent (daemon thread) triggers
the same stdin deadlock. The user has no way to respond to the
prompt or recover the session without killing the process.
Environment: Hermes 0.10.0, Linux, Python 3.11, prompt_toolkit 3.x
Workaround in use: Main agent falls back to executing blocked
steps directly via subprocess when subagents are blocked, bypassing
delegation entirely.
Noting this so the fix in #22989/#22987 covers permission prompts
from subagent daemon threads, not just destructive slash commands.
tgmerritt commentedon May 26, 2026
Confirmed in VS Code integrated terminal and in iTerm2 on Mac. I SSH into a separate system where hermes-agent runs.
Steps to reproduce:
Expected: A confirmation prompt appears and the session resets.
Actual: The screen never clears or resets. Everything freezes - pressing keys (characters, delete, spacebar) does not produce any visible output. The terminal becomes completely unresponsive and hangs permanently unless I right-click and kill/reset the terminal session.
Environment:
LZX0719-Hub commentedon May 28, 2026
Same issue on WSL (Windows Subsystem for Linux)
Confirmed on WSL 2 (Ubuntu) via Windows Terminal. The /reset and /new commands hang completely — the terminal becomes unresponsive and must be killed.
Additional symptoms on WSL:
[Errno 5] Input/output error— prompt_toolkit fails to write to stdout when rendering the confirmation modal, causing the process_loop to catch and log the error silently.Workarounds (confirmed working on WSL):
/reset nowor/new nowbypasses the modal entirely.approvals.destructive_slash_confirm: falsein config.yaml.Environment details:
Would be great if the fix also covers cases where the terminal write fails with EIO at the prompt_toolkit level, so the confirmation gracefully falls back to simple
input()or skips automatically.teknium1 commentedon Jun 11, 2026
This looks implemented on current main. Automated hermes-sweeper review found the destructive slash confirmation path no longer depends on raw
input()while prompt_toolkit owns stdin.Evidence:
cli.py:8501routes/clear,/new,/reset, and/undoconfirmations through the prompt_toolkit-native_prompt_text_input_modal(...)path, then persistsapprovals.destructive_slash_confirm: falsefor the “Always Approve” choice atcli.py:8526.cli.py:6298implements the modal by creating_slash_confirm_state, scheduling setup ontoself._app.loop.call_soon_threadsafewhen invoked off the main thread, and waiting on a response queue instead of reading stdin directly.cli.py:10979handles Enter while_slash_confirm_stateis active and returns before normal chat submission, so typed1/2/3resolve the modal rather than going to_pending_inputas a user message.cli.py:11321also binds number keys while the slash-confirm modal is active, so pressing1,2, or3submits the corresponding choice immediately.tests/cli/test_slash_confirm_windows.py:103, including daemon-thread modal routing on linux and win32, and a no-raw-input deadlock guard.tools/delegate_tool.py:1544, which installs a non-interactive approval callback in child worker threads so subagent dangerous-command prompts do not fall back toinput()and deadlock the parent TUI.Best implementation commit:
054f56857842a25b8ef5f627c7c951de28eee52a(fix: use TUI modal for slash confirmations). A later hardening commit,ab98818e5bf3d721d01f1b1899f60ceaeab2a2e9, keeps the modal path on native Windows. The slash-confirm fix is contained in release tagv2026.5.16.