hermes-agent/tests/cli
Teknium feddb86dbd
fix(cli): dispatch /steer inline while agent is running (#13354)
Classic-CLI /steer typed during an active agent run was queued through
self._pending_input alongside ordinary user input.  process_loop, which
drains that queue, is blocked inside self.chat() for the entire run,
so the queued command was not pulled until AFTER _agent_running had
flipped back to False — at which point process_command() took the idle
fallback ("No agent running; queued as next turn") and delivered the
steer as an ordinary next-turn user message.

From Utku's bug report on PR #13205: mid-run /steer arrived minutes
later at the end of the turn as a /queue-style message, completely
defeating its purpose.

Fix: add _should_handle_steer_command_inline() gating — when
_agent_running is True and the user typed /steer, dispatch
process_command(text) directly from the prompt_toolkit Enter handler
on the UI thread instead of queueing.  This mirrors the existing
_should_handle_model_command_inline() pattern for /model and is
safe because agent.steer() is thread-safe (uses _pending_steer_lock,
no prompt_toolkit state mutation, instant return).

No changes to the idle-path behavior: /steer typed with no active
agent still takes the normal queue-and-drain route so the fallback
"No agent running; queued as next turn" message is preserved.

Validation:
- 7 new unit tests in tests/cli/test_cli_steer_busy_path.py covering
  the detector, dispatch path, and idle-path control behavior.
- All 21 existing tests in tests/run_agent/test_steer.py still pass.
- Live PTY end-to-end test with real agent + real openrouter model:
    22:36:22 API call #1 (model requested execute_code)
    22:36:26 ENTER FIRED: agent_running=True, text='/steer ...'
    22:36:26 INLINE STEER DISPATCH fired
    22:36:43 agent.log: 'Delivered /steer to agent after tool batch'
    22:36:44 API call #2 included the steer; response contained marker
  Same test on the tip of main without this fix shows the steer
  landing as a new user turn ~20s after the run ended.
2026-04-20 23:05:38 -07:00
..
__init__.py
test_branch_command.py
test_cli_approval_ui.py
test_cli_background_tui_refresh.py
test_cli_browser_connect.py
test_cli_context_warning.py
test_cli_copy_command.py
test_cli_extension_hooks.py
test_cli_external_editor.py feat(cli): add editor workflow for drafts 2026-04-20 02:53:40 -07:00
test_cli_file_drop.py
test_cli_image_command.py
test_cli_init.py
test_cli_interrupt_subagent.py
test_cli_loading_indicator.py
test_cli_markdown_rendering.py feat(cli): strip markdown formatting from final replies 2026-04-20 02:53:40 -07:00
test_cli_mcp_config_watch.py
test_cli_new_session.py
test_cli_plan_command.py
test_cli_prefix_matching.py
test_cli_preloaded_skills.py
test_cli_provider_resolution.py refactor: remove smart_model_routing feature (#12732) 2026-04-19 18:12:55 -07:00
test_cli_retry.py
test_cli_save_config_value.py
test_cli_secret_capture.py
test_cli_skin_integration.py
test_cli_status_bar.py fix(cli): use display width for wrapped spinner height 2026-04-18 14:34:05 -07:00
test_cli_status_command.py
test_cli_steer_busy_path.py fix(cli): dispatch /steer inline while agent is running (#13354) 2026-04-20 23:05:38 -07:00
test_cli_tools_command.py
test_cli_user_message_preview.py feat(cli): improve multiline previews 2026-04-20 02:53:40 -07:00
test_compress_focus.py
test_cwd_env_respect.py
test_fast_command.py refactor: remove smart_model_routing feature (#12732) 2026-04-19 18:12:55 -07:00
test_gquota_command.py fix(cli): sanitize interactive command output 2026-04-19 01:16:34 -07:00
test_manual_compress.py fix(cli): sync session_id after compression and preserve original end_reason (#12920) 2026-04-20 01:48:20 -07:00
test_personality_none.py
test_quick_commands.py fix(cli): sanitize interactive command output 2026-04-19 01:16:34 -07:00
test_reasoning_command.py test: update stale tests to match current code (#11963) 2026-04-17 21:35:30 -07:00
test_resume_display.py fix(cli): strip all reasoning tag variants from /resume recap 2026-04-18 19:19:24 -07:00
test_session_boundary_hooks.py
test_stream_delta_think_tag.py
test_surrogate_sanitization.py
test_tool_progress_scrollback.py
test_worktree_security.py
test_worktree.py