From f6060f9c53b808df7c2403b83671db413e42b1aa Mon Sep 17 00:00:00 2001 From: Vasi <46072705+VasilisAvgoustakis@users.noreply.github.com> Date: Thu, 24 Jul 2025 16:13:19 +0200 Subject: [PATCH] feat: [CLI] 9392 cli improve confirmation ux - revisited (#9824) Co-authored-by: bavg --- openhands/cli/main.py | 11 ++--------- openhands/cli/tui.py | 5 ++--- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/openhands/cli/main.py b/openhands/cli/main.py index ae2923f2d7..b146900817 100644 --- a/openhands/cli/main.py +++ b/openhands/cli/main.py @@ -239,7 +239,7 @@ async def run_session( ChangeAgentStateAction(AgentState.USER_CONFIRMED), EventSource.USER, ) - elif confirmation_status == 'edit': + else: # 'no' or alternative instructions # Tell the agent the proposed action was rejected event_stream.add_event( ChangeAgentStateAction(AgentState.USER_REJECTED), @@ -248,16 +248,9 @@ async def run_session( # Notify the user print_formatted_text( HTML( - 'Okay, please tell me what I should do instead.' + 'Okay, please tell me what I should do next/instead.' ) ) - # Solicit replacement isntructions - await prompt_for_next_task(AgentState.AWAITING_USER_INPUT) - else: # 'no' or fallback - event_stream.add_event( - ChangeAgentStateAction(AgentState.USER_REJECTED), - EventSource.USER, - ) # Set the always_confirm_mode flag if the user wants to always confirm if confirmation_status == 'always': diff --git a/openhands/cli/tui.py b/openhands/cli/tui.py index 287cff42da..a81e4627a3 100644 --- a/openhands/cli/tui.py +++ b/openhands/cli/tui.py @@ -704,9 +704,8 @@ async def read_confirmation_input(config: OpenHandsConfig) -> str: try: choices = [ 'Yes, proceed', - 'No, skip this action', + 'No (and allow to enter instructions)', "Always proceed (don't ask again)", - 'Let me provide different instructions', ] # keep the outer coroutine responsive by using asyncio.to_thread which puts the blocking call app.run() of cli_confirm() in a separate thread @@ -714,7 +713,7 @@ async def read_confirmation_input(config: OpenHandsConfig) -> str: cli_confirm, config, 'Choose an option:', choices ) - return {0: 'yes', 1: 'no', 2: 'always', 3: 'edit'}.get(index, 'no') + return {0: 'yes', 1: 'no', 2: 'always'}.get(index, 'no') except (KeyboardInterrupt, EOFError): return 'no'