feat(cli): add busy_input_toggle_key to flip interrupt/queue mode at runtime - #4903
feat(cli): add busy_input_toggle_key to flip interrupt/queue mode at runtime#4903hbmartin wants to merge 1 commit into
Conversation
…runtime
Adds a configurable keybinding (display.busy_input_toggle_key in
config.yaml) that toggles busy_input_mode between 'interrupt' and
'queue' without restarting the session.
- Read busy_input_toggle_key from display config on startup
- Register a kb.add() handler when the key is set that flips
self.busy_input_mode and prints a brief status line
- Show a dim [Q] indicator in the status bar when queue mode is active
(all three width variants: <52, <76, full)
- Document the option in cli-config.yaml.example alongside busy_input_mode
- Default is null (no key bound) so existing behavior is unchanged
Example config:
display:
busy_input_toggle_key: c-t
Ctrl+C always interrupts regardless of this setting.
teknium1
left a comment
There was a problem hiding this comment.
Thanks for the focused CLI UX improvement. The requested hotkey is not present on current main, but this implementation needs adaptation to current busy-input behavior.
Problems
- Current main has a third
steermode (cli.py:3734-3743, dispatched atcli.py:13503-13531). The PR handler atcli.py:7563-7568maps every non-interruptmode tointerrupt, so a user configured forsteerloses steering on the first toggle. - The example lists
c-q(cli-config.yaml.example:728), but current main binds Ctrl+Q to interrupt/exit behavior (cli.py:13889-13954). - The PR has no tests for registration, three-mode transitions, or binding collisions; current
/busymode coverage lives intests/cli/test_busy_input_mode_command.py:44-95.
Suggested changes
- Rework the toggle around the current three-mode contract, with explicit tested semantics for
steer. - Reserve or reject existing bindings such as
c-q, and add focused keybinding tests. - Document the finalized behavior in
website/docs/user-guide/cli.mdas well as the example config.
This is an automated hermes-sweeper review.
| @kb.add(cli_ref.busy_input_toggle_key) | ||
| def handle_busy_input_toggle(event): | ||
| """Toggle busy_input_mode between 'interrupt' and 'queue'.""" | ||
| if cli_ref.busy_input_mode == "interrupt": |
There was a problem hiding this comment.
Current main now has a third steer mode (cli.py:3737-3743) with a distinct agent.steer() dispatch path (cli.py:13503-13531). This else turns steer into interrupt; please define and test a three-mode-safe transition before salvaging.
| # Keybinding to toggle between interrupt and queue mode at runtime (CLI only). | ||
| # When pressed while Hermes is running, flips busy_input_mode between | ||
| # "interrupt" and "queue" without restarting the session. | ||
| # Accepts prompt_toolkit key names: "c-t" (Ctrl+T), "f2", "c-q", etc. |
There was a problem hiding this comment.
c-q is no longer a safe example: current main binds Ctrl+Q at cli.py:13889 as an interrupt/exit shortcut. Reserve or reject collisions with existing bindings instead of advertising them as usable.
Summary
Adds
display.busy_input_toggle_key— a configurable keybinding that togglesbusy_input_modebetweeninterruptandqueueat runtime, without restarting the session.Motivated by the UX friction of having to choose one mode statically via config. Users often want
interruptas the default but occasionally want to queue a follow-up thought while the agent is mid-task — without prepending/queueevery time.Changes
hermes_cli/config.py— addsbusy_input_toggle_key: NonetoDEFAULT_CONFIG["display"]. Default isnullso no behavior change for existing users.cli.py— reads the key at startup; registers akb.add()handler (only when a key is configured) that flipsself.busy_input_modeand prints a brief inline status message; adds a dim[Q]indicator to all three status bar width variants when queue mode is active.cli-config.yaml.example— documents the new option alongsidebusy_input_mode.Usage
Pressing the key at any time prints:
or
The status bar shows
[Q]next to the model name whenever queue mode is active.Accepts any prompt_toolkit key name:
c-t,f2,c-q, etc.Notes
/queue <message>still works as a one-off escape hatchbusy_input_modebranch inhandle_enter