π OpenHands: AI-Driven Development
feat: [CLI] 9392 cli improve confirmation ux - revisited (#9824)
Vasif6060f9c53b8
diff --git a/openhands/cli/main.py b/openhands/cli/main.pyindex 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 rejectedevent_stream.add_event(ChangeAgentStateAction(AgentState.USER_REJECTED),@@ -248,16 +248,9 @@ async def run_session(# Notify the userprint_formatted_text(HTML(- '<skyblue>Okay, please tell me what I should do instead.</skyblue>'+ '<skyblue>Okay, please tell me what I should do next/instead.</skyblue>'))- # 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 confirmif confirmation_status == 'always':diff --git a/openhands/cli/tui.py b/openhands/cli/tui.pyindex 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'