From a4785bbc139e71078af7f1cda739565b20bb8e8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=AE=AE=E0=AE=A9=E0=AF=8B=E0=AE=9C=E0=AF=8D=E0=AE=95?= =?UTF-8?q?=E0=AF=81=E0=AE=AE=E0=AE=BE=E0=AE=B0=E0=AF=8D=20=E0=AE=AA?= =?UTF-8?q?=E0=AE=B4=E0=AE=A9=E0=AE=BF=E0=AE=9A=E0=AF=8D=E0=AE=9A=E0=AE=BE?= =?UTF-8?q?=E0=AE=AE=E0=AE=BF?= Date: Tue, 14 Jan 2025 11:34:34 +0530 Subject: [PATCH] Exit with error code https://github.com/All-Hands-AI/OpenHands/pull/2841/files/019e7b17938519f3ed1e5044c2567f75e08fd917#diff-b764c5398bce883365e8821577ee6017565697e91e62dc06ef0c63b250f26aca --- openhands/core/main.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/openhands/core/main.py b/openhands/core/main.py index 8b4c1f1cb646..4ffff5175605 100644 --- a/openhands/core/main.py +++ b/openhands/core/main.py @@ -74,7 +74,7 @@ async def run_controller( exit_on_message: bool = False, fake_user_response_fn: FakeUserResponseFunc | None = None, headless_mode: bool = True, -) -> State | None: +) -> State: """Main coroutine to run the agent controller with task input flexibility. It's only used when you launch openhands backend directly via cmdline. @@ -214,7 +214,7 @@ def auto_continue_response( session_name = args.name sid = generate_sid(config, session_name) - asyncio.run( + final_state = asyncio.run( run_controller( config=config, initial_user_action=initial_user_action, @@ -224,3 +224,6 @@ def auto_continue_response( else auto_continue_response, ) ) + + if final_state.last_error: + sys.exit(1)