fix(cli): keep approval prompts visible in scrollback - #64475
fix(cli): keep approval prompts visible in scrollback#64475visualfox-ch wants to merge 1 commit into
Conversation
Preserve a plaintext pending-approval notice when prompt_toolkit repaints race with background-thread approvals. Assisted-by: Hermes:gpt-5.6-sol
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: Approved
Fix to keep approval prompts visible in scrollback. Small change (49 additions, 1 deletion). Clean UX fix.
Reviewed by Hermes Agent
teknium1
left a comment
There was a problem hiding this comment.
Thanks for addressing a real classic-CLI visibility gap: current HermesCLI._approval_callback sets its modal state and then waits, while the existing scrollback summary is only emitted after a choice is received (cli.py:11785-11822). The new _cprint call uses the established output-history and cross-thread prompt_toolkit path (cli.py:2593-2667).
Problems
- The new test has a scheduling race: it waits for
_approval_state, which is set before the new_cprint, then immediately reads the mock call list (tests/cli/test_cli_approval_ui.py:119in this diff). The callback thread can yield in between. - The
hermes_cli/callbacks.pychange targetsapproval_callback, but repository-wide search found no in-tree caller; the active CLI registersself._approval_callback(cli.py:6091,cli.py:12418). That unused path also bypasses CLI_cprint's output-history handling.
Suggested changes
- Wait for the mock pending-notice call with a bounded deadline before asserting its content.
- Remove the unwired callback-module edit unless it is intentionally being wired into a supported path.
Automated hermes-sweeper review.
| time.sleep(0.01) | ||
|
|
||
| assert cli._approval_state is not None | ||
| rendered = "\n".join(str(call.args[0]) for call in cprint.call_args_list) |
There was a problem hiding this comment.
This waits only for _approval_state, but the callback assigns that state before it calls _cprint. Please wait (with the same bounded deadline) for cprint.call_args_list to become non-empty before reading it; otherwise a scheduler switch between those operations makes this test flaky.
Summary
Test plan
python -m pytest tests/cli/test_cli_approval_ui.py -q -o 'addopts='ruff check cli.py hermes_cli/callbacks.py tests/cli/test_cli_approval_ui.py