diff --git a/openhands/events/event.py b/openhands/events/event.py index 7902662735..6c7a2d8a3a 100644 --- a/openhands/events/event.py +++ b/openhands/events/event.py @@ -67,6 +67,13 @@ class Event: @timeout.setter def timeout(self, value: int | None) -> None: self._timeout = value + if value is not None and value > 600: + from openhands.core.logger import openhands_logger as logger + + logger.warning( + 'Timeout greater than 600 seconds may not be supported by ' + 'the runtime. Consider setting a lower timeout.' + ) # Check if .blocking is an attribute of the event if hasattr(self, 'blocking'): diff --git a/openhands/runtime/utils/bash.py b/openhands/runtime/utils/bash.py index 70a24e2189..351d990dcd 100644 --- a/openhands/runtime/utils/bash.py +++ b/openhands/runtime/utils/bash.py @@ -486,18 +486,6 @@ class BashSession: last_change_time = start_time last_pane_output = self._get_pane_content() - _ps1_matches = CmdOutputMetadata.matches_ps1_metadata(last_pane_output) - assert len(_ps1_matches) >= 1, ( - 'Expected at least one PS1 metadata block BEFORE the execution of a command, ' - f'but got {len(_ps1_matches)} PS1 metadata blocks:\n---\n{last_pane_output!r}\n---' - ) - if len(_ps1_matches) > 1: - logger.warning( - 'Found multiple PS1 metadata blocks BEFORE the execution of a command. ' - 'Only the last one will be used.' - ) - _ps1_matches = [_ps1_matches[-1]] - if command != '': # convert command to raw string command = escape_bash_special_chars(command) diff --git a/openhands/runtime/utils/request.py b/openhands/runtime/utils/request.py index a145bd27f4..2a0e17aa0f 100644 --- a/openhands/runtime/utils/request.py +++ b/openhands/runtime/utils/request.py @@ -21,7 +21,7 @@ class RequestHTTPError(requests.HTTPError): return s -def is_rate_limit_error(exception): +def is_retryable_error(exception): return ( isinstance(exception, requests.HTTPError) and exception.response.status_code == 429 @@ -29,7 +29,7 @@ def is_rate_limit_error(exception): @retry( - retry=retry_if_exception(is_rate_limit_error), + retry=retry_if_exception(is_retryable_error), stop=stop_after_attempt(3) | stop_if_should_exit(), wait=wait_exponential(multiplier=1, min=4, max=60), ) diff --git a/pyproject.toml b/pyproject.toml index 1a15ae754c..3753ae45d2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -101,6 +101,7 @@ reportlab = "*" [tool.coverage.run] concurrency = ["gevent"] + [tool.poetry.group.runtime.dependencies] jupyterlab = "*" notebook = "*" @@ -129,6 +130,7 @@ ignore = ["D1"] [tool.ruff.lint.pydocstyle] convention = "google" + [tool.poetry.group.evaluation.dependencies] streamlit = "*" whatthepatch = "*"