Skip to content

fix: use TUI modal for slash confirmations#23571

Closed
zhengyn0001 wants to merge 1 commit into
NousResearch:mainfrom
zhengyn0001:fix/cli-slash-confirm-modal
Closed

fix: use TUI modal for slash confirmations#23571
zhengyn0001 wants to merge 1 commit into
NousResearch:mainfrom
zhengyn0001:fix/cli-slash-confirm-modal

Conversation

@zhengyn0001

Copy link
Copy Markdown
Contributor

Summary

Fixes CLI slash confirmation prompts such as /new, /clear, /undo, and /reload-mcp when running inside the prompt_toolkit TUI.

Previously these confirmations used raw text input, which could race with prompt_toolkit stdin ownership. In some terminals this caused:

  • Choice [1/2/3]: to appear before the option labels
  • number keys to be swallowed or handled out of order
  • /new to report cancelled (no input)
  • the CLI to exit unexpectedly after choosing an option

This changes slash confirmations to use a prompt_toolkit-native modal with:

  • visible 1/2/3 choice labels
  • direct number-key selection
  • arrow-key navigation + Enter
  • ESC / Ctrl+C cancellation

The raw _prompt_text_input() path remains as a fallback for non-interactive or edge cases.

Tests

/Users/Zhuanz/.hermes/hermes-agent/venv/bin/python -m pytest tests/cli/test_destructive_slash_confirm.py tests/cli/test_prompt_text_input_thread_safety.py -q -o 'addopts='

Result:

14 passed in 0.79s

@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 comp/tui Terminal UI (ui-tui/ + tui_gateway/) labels May 11, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Merged via PR #23907 — your implementation was selected as the cleanest fix (full prompt_toolkit-native modal mirroring the existing _approval_state architecture). Authorship preserved via rebase-merge as commit 054f568 on main. Closes #23694 and #23853. Thank you for the contribution!

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 comp/tui Terminal UI (ui-tui/ + tui_gateway/) 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.

3 participants