From 50d311776dd7079134c854807ccbc1dcd17389eb Mon Sep 17 00:00:00 2001 From: DoubleDensity Date: Mon, 16 Mar 2026 13:04:05 -0400 Subject: [PATCH] Fixes conversations that stop responding due to stale execution status https://openhands-ai.slack.com/archives/C06U8UTKSAD/p1773351234338059?thread_ts=1773161499.244319&cid=C06U8UTKSAD Fix was generated by OpenHands here: https://app.all-hands.dev/conversations/9eaa41581dfa476aaca0009118cfd5be --- openhands-sdk/openhands/sdk/conversation/state.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/openhands-sdk/openhands/sdk/conversation/state.py b/openhands-sdk/openhands/sdk/conversation/state.py index 2f396dc1169..4f1f6c06d9c 100644 --- a/openhands-sdk/openhands/sdk/conversation/state.py +++ b/openhands-sdk/openhands/sdk/conversation/state.py @@ -336,6 +336,16 @@ def create( # Verify compatibility (agent class + tools) agent.verify(state.agent, events=state._events) + # Reset terminal statuses to IDLE on resume. + # This ensures conversations stuck in STUCK, ERROR, or FINISHED + # can recover without requiring send_message() or run() to be called first. + if state.execution_status in ( + ConversationExecutionStatus.FINISHED, + ConversationExecutionStatus.ERROR, + ConversationExecutionStatus.STUCK, + ): + state.execution_status = ConversationExecutionStatus.IDLE + # Commit runtime-provided values (may autosave) state._autosave_enabled = True state.agent = agent