π OpenHands: AI-Driven Development
(fix) runtime: tweak _wait_until_alive tenacity and exception handling (#3878)
tobitegea45b20a406be
diff --git a/openhands/runtime/client/runtime.py b/openhands/runtime/client/runtime.pyindex b295ff26c6..253d84e80b 100644--- a/openhands/runtime/client/runtime.py+++ b/openhands/runtime/client/runtime.py@@ -295,7 +295,6 @@ class EventStreamRuntime(Runtime):def _wait_until_alive(self):logger.debug('Getting container logs...')- # Print and clear the log bufferassert (self.log_buffer is not None), 'Log buffer is expected to be initialized when container is started'@@ -317,9 +316,9 @@ class EventStreamRuntime(Runtime):if not self.log_buffer.client_ready:time.sleep(1)attempts = 0- while not self.log_buffer.client_ready and attempts < 4:+ while not self.log_buffer.client_ready and attempts < 5:attempts += 1- time.sleep(2)+ time.sleep(1)logs = self.log_buffer.get_and_clear()if logs:formatted_logs = '\n'.join([f' |{log}' for log in logs])@@ -436,8 +435,8 @@ class EventStreamRuntime(Runtime):except Exception as e:logger.error(f'Error during command execution: {e}')obs = ErrorObservation(f'Command execution failed: {str(e)}')- # Refresh docker logs- self._wait_until_alive()+ # TODO Refresh docker logs or not?+ # self._wait_until_alive()return obsdef run(self, action: CmdRunAction) -> Observation: