Przeglądaj źródła

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

This reverts commit dd2cb4399a654d90efe5bce3909c6db9575753ec.
Xingyao Wang 1 rok temu
rodzic
commit
240a470a1d

+ 1 - 2
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()

+ 2 - 3
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)
                     ),

+ 0 - 25
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: