Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Runtime): Wait for container to start up #7548

Merged
merged 3 commits into from
Mar 27, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion openhands/runtime/impl/docker/docker_runtime.py
Original file line number Diff line number Diff line change
@@ -37,6 +37,16 @@
APP_PORT_RANGE_2 = (55000, 59999)


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)
)


class DockerRuntime(ActionExecutionClient):
"""This runtime will subscribe the event stream.
@@ -347,7 +357,7 @@ def _attach_to_container(self):

@tenacity.retry(
stop=tenacity.stop_after_delay(120) | stop_if_should_exit(),
retry=tenacity.retry_if_exception_type((ConnectionError, httpx.NetworkError)),
retry=tenacity.retry_if_exception(_is_retryable_wait_until_alive_error),
reraise=True,
wait=tenacity.wait_fixed(2),
)

Unchanged files with check annotations Beta

// https://tanstack.com/query/latest/docs/framework/react/guides/initial-query-data#using-initialdata-to-prepopulate-a-query
if (query.error?.status === 404) {
return {
...query,

Check warning on line 62 in frontend/src/hooks/query/use-settings.ts

GitHub Actions / Lint frontend

Object rest destructuring on a query will observe all changes to the query, leading to excessive re-renders
data: DEFAULT_SETTINGS,
};
}