Skip to content

πŸ™Œ OpenHands: AI-Driven Development

Revert "add few seconds to properly receive timeout error from client"

Xingyao Wang240a470a1d8d
diff --git a/openhands/runtime/client/runtime.py b/openhands/runtime/client/runtime.py
index 8c714fbedc..32b002f3ea 100644
--- a/openhands/runtime/client/runtime.py
+++ b/openhands/runtime/client/runtime.py
@@ -418,8 +418,7 @@ class EventStreamRuntime(Runtime):
response = self.session.post(
f'{self.api_url}/execute_action',
json={'action': event_to_dict(action)},
- # wait a few more seconds to get the timeout error from client side
- timeout=action.timeout + 5,
+ timeout=action.timeout,
)
if response.status_code == 200:
output = response.json()
diff --git a/openhands/runtime/remote/runtime.py b/openhands/runtime/remote/runtime.py
index 67281c6fd9..8d8dbd52c3 100644
--- a/openhands/runtime/remote/runtime.py
+++ b/openhands/runtime/remote/runtime.py
@@ -36,13 +36,13 @@ from openhands.events.serialization.action import ACTION_TYPE_TO_CLASS
from openhands.runtime.builder.remote import RemoteRuntimeBuilder
from openhands.runtime.plugins import PluginRequirement
from openhands.runtime.runtime import Runtime
+from openhands.utils.tenacity_stop import stop_if_should_exit
from openhands.runtime.utils.request import (
DEFAULT_RETRY_EXCEPTIONS,
is_404_error,
send_request,
)
from openhands.runtime.utils.runtime_build import build_runtime_image
-from openhands.utils.tenacity_stop import stop_if_should_exit
class RemoteRuntime(Runtime):
@@ -260,8 +260,7 @@ class RemoteRuntime(Runtime):
'POST',
f'{self.runtime_url}/execute_action',
json=request_body,
- # wait a few more seconds to get the timeout error from client side
- timeout=action.timeout + 5,
+ timeout=action.timeout,
retry_exceptions=list(
filter(lambda e: e != TimeoutError, DEFAULT_RETRY_EXCEPTIONS)
),
diff --git a/tests/runtime/test_bash.py b/tests/runtime/test_bash.py
index 1c21a2e946..c28957888d 100644
--- a/tests/runtime/test_bash.py
+++ b/tests/runtime/test_bash.py
@@ -57,31 +57,6 @@ def test_bash_command_pexcept(temp_dir, box_class, run_as_openhands):
_close_test_runtime(runtime)
-def test_bash_timeout_and_keyboard_interrupt(temp_dir, box_class, run_as_openhands):
- runtime = _load_runtime(temp_dir, box_class, run_as_openhands)
- try:
- action = CmdRunAction(command='python -c "import time; time.sleep(10)"')
- action.timeout = 1
- obs = runtime.run_action(action)
- logger.info(obs, extra={'msg_type': 'OBSERVATION'})
- assert isinstance(obs, CmdOutputObservation)
- assert (
- '[Command timed out after 1 seconds. SIGINT was sent to interrupt it.]'
- in obs.content
- )
- assert 'KeyboardInterrupt' in obs.content
-
- # follow up command should not be affected
- action = CmdRunAction(command='ls')
- action.timeout = 1
- obs = runtime.run_action(action)
- assert isinstance(obs, CmdOutputObservation)
- assert obs.exit_code == 0
- logger.info(obs, extra={'msg_type': 'OBSERVATION'})
- finally:
- _close_test_runtime(runtime)
-
-
def test_multiline_commands(temp_dir, box_class):
runtime = _load_runtime(temp_dir, box_class)
try: