fix(cli): keep slash confirmation modal on app loop - #32808
fix(cli): keep slash confirmation modal on app loop#32808stephenschoettler wants to merge 1 commit into
Conversation
|
Likely duplicate of #32387 — both fix the POSIX worker-thread slash confirmation modal freeze (same root cause from #32013/#32383) using Related: #32383 (issue), #22958 (original issue), #32013 (merged PR that introduced the regression). |
|
Thanks - agreed. I missed #32387/#32383 when checking only #25404 and the older #22958 thread. This is duplicative of #32387 for the main fix path, so I am closing this one rather than adding PR noise. The only small delta here is that this branch returns |
What does this PR do?
Fixes the destructive slash confirmation modal for
/clear,/new,/reset, and/undowhen those commands are processed from the CLI worker thread on POSIX terminals.The existing code falls back to raw
input()whenever_prompt_text_input_modal()is called off the main thread. That is the broken path in #22958: prompt_toolkit still owns stdin, so1,2, or3can leak into the composer instead of reaching the confirmation prompt.This keeps the Windows stdin fallback for #30768, but on POSIX with a running prompt_toolkit app it schedules modal open and close work onto
app.loop.call_soon_threadsafe(...)and waits on the existing modal response queue.This is intentionally narrower than #25404. That PR changes
_prompt_text_input()in a mixed-scope branch, but does not fix the worker-thread_prompt_text_input_modal()fallback that handles destructive slash confirmations.Related Issue
Fixes #22958
Type of Change
Changes Made
cli.pyinput()fallback while prompt_toolkit owns stdin.call_soon_threadsafe.title,detail,choices, andselectedvalues used by the modal state.tests/cli/test_slash_confirm_windows.pyNonewithout falling back to raw stdin.How to Test
/home/w0lf/hermes-agent/venv/bin/python -m pytest tests/cli/test_slash_confirm_windows.py tests/cli/test_destructive_slash_inline_skip_e2e.py -q -o 'addopts='/home/w0lf/hermes-agent/venv/bin/python -m py_compile cli.py tests/cli/test_slash_confirm_windows.pygit diff --check/home/w0lf/hermes-agent/venv/bin/python scripts/check-windows-footguns.py cli.py tests/cli/test_slash_confirm_windows.pyHERMES_HOME./new.1.1does not appear as a chat message.Local validation performed on Linux:
Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/AFor New Skills
N/A
Screenshots / Logs