OpenHands icon indicating copy to clipboard operation
OpenHands copied to clipboard

fix: Runtime local docker environment HTTPStatusError

Open Randonee1 opened this issue 8 months ago • 0 comments

  • [ ] This change is worth documenting at https://docs.all-hands.dev/
  • [ ] Include this change in the Release Notes. If checked, you must provide an end-user friendly description for your change below

End-user friendly description of the problem this fixes or functionality that this introduces.

This pull request addresses an issue where openhands.runtime.utils.request.RequestHTTPError: 503 Server Error: Service Unavailable occurring in the local docker environment is not being caught by the retry_if_exception. This fix ensures that such errors are properly handled and retried, improving the reliability of the system in local development environments.


Give a summary of what the PR does, explaining any non-trivial design decisions.

Adding httpx.HTTPStatusError to _is_retryable_wait_until_alive_error in openhands/runtime/impl/docker/docker_runtime.py

def _is_retryable_wait_until_alive_error(exception):
    if isinstance(exception, tenacity.RetryError):
        cause = exception.last_attempt.exception()
        return _is_retryable_wait_until_alive_error(cause)

    return isinstance(
        exception,
        (
            ConnectionError,
            httpx.NetworkError,
            httpx.RemoteProtocolError,
            httpx.HTTPStatusError,
        ),
    )

Link of any specific issues this addresses.

Discussions in https://github.com/All-Hands-AI/OpenHands/pull/7374#:~:text=def%20_is_retryable_wait_until_alive_error(exception)%3A%0A%20%20%20,httpx.HTTPStatusError)%0A%20%20%20%20

Randonee1 avatar Apr 02 '25 07:04 Randonee1