π OpenHands: AI-Driven Development
fix docker leak (#4970)
Robert Brennanf55ddbed0eba
diff --git a/openhands/controller/agent_controller.py b/openhands/controller/agent_controller.pyindex d0b806a3f1..78b27c89ff 100644--- a/openhands/controller/agent_controller.py+++ b/openhands/controller/agent_controller.py@@ -42,7 +42,7 @@ from openhands.events.observation import ()from openhands.events.serialization.event import truncate_contentfrom openhands.llm.llm import LLM-from openhands.runtime.utils.shutdown_listener import should_continue+from openhands.utils.shutdown_listener import should_continue# note: RESUME is only available on web GUITRAFFIC_CONTROL_REMINDER = (diff --git a/openhands/events/stream.py b/openhands/events/stream.pyindex 625abd7a52..24e95bf981 100644--- a/openhands/events/stream.py+++ b/openhands/events/stream.py@@ -9,9 +9,9 @@ from openhands.core.logger import openhands_logger as loggerfrom openhands.core.utils import jsonfrom openhands.events.event import Event, EventSourcefrom openhands.events.serialization.event import event_from_dict, event_to_dict-from openhands.runtime.utils.shutdown_listener import should_continuefrom openhands.storage import FileStorefrom openhands.utils.async_utils import call_sync_from_async+from openhands.utils.shutdown_listener import should_continueclass EventStreamSubscriber(str, Enum):diff --git a/openhands/llm/async_llm.py b/openhands/llm/async_llm.pyindex f2226dcd16..ed84273c73 100644--- a/openhands/llm/async_llm.py+++ b/openhands/llm/async_llm.py@@ -7,7 +7,7 @@ from litellm import acompletion as litellm_acompletionfrom openhands.core.exceptions import UserCancelledErrorfrom openhands.core.logger import openhands_logger as loggerfrom openhands.llm.llm import LLM, LLM_RETRY_EXCEPTIONS-from openhands.runtime.utils.shutdown_listener import should_continue+from openhands.utils.shutdown_listener import should_continueclass AsyncLLM(LLM):diff --git a/openhands/runtime/__init__.py b/openhands/runtime/__init__.pyindex 66c89dadca..16534daf6b 100644--- a/openhands/runtime/__init__.py+++ b/openhands/runtime/__init__.py@@ -1,31 +1,25 @@from openhands.core.logger import openhands_logger as loggerfrom openhands.runtime.impl.e2b.sandbox import E2BBox+from openhands.runtime.impl.eventstream.eventstream_runtime import (+ EventStreamRuntime,+)+from openhands.runtime.impl.modal.modal_runtime import ModalRuntime+from openhands.runtime.impl.remote.remote_runtime import RemoteRuntime+from openhands.runtime.impl.runloop.runloop_runtime import RunloopRuntimedef get_runtime_cls(name: str):# Local imports to avoid circular importsif name == 'eventstream':- from openhands.runtime.impl.eventstream.eventstream_runtime import (- EventStreamRuntime,- )-return EventStreamRuntimeelif name == 'e2b':- from openhands.runtime.impl.e2b.e2b_runtime import E2BRuntime-- return E2BRuntime+ return E2BBoxelif name == 'remote':- from openhands.runtime.impl.remote.remote_runtime import RemoteRuntime-return RemoteRuntimeelif name == 'modal':logger.debug('Using ModalRuntime')- from openhands.runtime.impl.modal.modal_runtime import ModalRuntime-return ModalRuntimeelif name == 'runloop':- from openhands.runtime.impl.runloop.runloop_runtime import RunloopRuntime-return RunloopRuntimeelse:raise ValueError(f'Runtime {name} not supported')@@ -33,5 +27,9 @@ def get_runtime_cls(name: str):__all__ = ['E2BBox',+ 'RemoteRuntime',+ 'ModalRuntime',+ 'RunloopRuntime',+ 'EventStreamRuntime','get_runtime_cls',]diff --git a/openhands/runtime/browser/browser_env.py b/openhands/runtime/browser/browser_env.pyindex 9bad97b9bb..d9a7fd7529 100644--- a/openhands/runtime/browser/browser_env.py+++ b/openhands/runtime/browser/browser_env.py@@ -16,7 +16,7 @@ from PIL import Imagefrom openhands.core.exceptions import BrowserInitExceptionfrom openhands.core.logger import openhands_logger as logger-from openhands.runtime.utils.shutdown_listener import should_continue, should_exit+from openhands.utils.shutdown_listener import should_continue, should_exitfrom openhands.utils.tenacity_stop import stop_if_should_exitBROWSER_EVAL_GET_GOAL_ACTION = 'GET_EVAL_GOAL'diff --git a/openhands/runtime/builder/remote.py b/openhands/runtime/builder/remote.pyindex b1b14752cb..c9d3228a70 100644--- a/openhands/runtime/builder/remote.py+++ b/openhands/runtime/builder/remote.py@@ -8,7 +8,7 @@ import requestsfrom openhands.core.logger import openhands_logger as loggerfrom openhands.runtime.builder import RuntimeBuilderfrom openhands.runtime.utils.request import send_request-from openhands.runtime.utils.shutdown_listener import (+from openhands.utils.shutdown_listener import (should_continue,sleep_if_should_continue,)diff --git a/openhands/runtime/plugins/jupyter/__init__.py b/openhands/runtime/plugins/jupyter/__init__.pyindex dd98428302..23128b60a8 100644--- a/openhands/runtime/plugins/jupyter/__init__.py+++ b/openhands/runtime/plugins/jupyter/__init__.py@@ -8,7 +8,7 @@ from openhands.events.observation import IPythonRunCellObservationfrom openhands.runtime.plugins.jupyter.execute_server import JupyterKernelfrom openhands.runtime.plugins.requirement import Plugin, PluginRequirementfrom openhands.runtime.utils import find_available_tcp_port-from openhands.runtime.utils.shutdown_listener import should_continue+from openhands.utils.shutdown_listener import should_continue@dataclassdiff --git a/openhands/runtime/utils/tenacity_stop.py b/openhands/runtime/utils/tenacity_stop.pyindex 48fdead866..d9aa83a613 100644--- a/openhands/runtime/utils/tenacity_stop.py+++ b/openhands/runtime/utils/tenacity_stop.py@@ -1,7 +1,7 @@from tenacity import RetryCallStatefrom tenacity.stop import stop_base-from openhands.runtime.utils.shutdown_listener import should_exit+from openhands.utils.shutdown_listener import should_exitclass stop_if_should_exit(stop_base):diff --git a/openhands/server/mock/listen.py b/openhands/server/mock/listen.pyindex 9b9d1560e8..81367a855d 100644--- a/openhands/server/mock/listen.py+++ b/openhands/server/mock/listen.py@@ -3,7 +3,7 @@ from fastapi import FastAPI, WebSocketfrom openhands.core.logger import openhands_logger as loggerfrom openhands.core.schema import ActionType-from openhands.runtime.utils.shutdown_listener import should_continue+from openhands.utils.shutdown_listener import should_continueapp = FastAPI()diff --git a/openhands/server/session/session.py b/openhands/server/session/session.pyindex 25f707f15f..e70d80e84f 100644--- a/openhands/server/session/session.py+++ b/openhands/server/session/session.py@@ -21,9 +21,9 @@ from openhands.events.observation.error import ErrorObservationfrom openhands.events.serialization import event_from_dict, event_to_dictfrom openhands.events.stream import EventStreamSubscriberfrom openhands.llm.llm import LLM-from openhands.runtime.utils.shutdown_listener import should_continuefrom openhands.server.session.agent_session import AgentSessionfrom openhands.storage.files import FileStore+from openhands.utils.shutdown_listener import should_continueclass Session:diff --git a/openhands/runtime/utils/shutdown_listener.py b/openhands/utils/shutdown_listener.pysimilarity index 100%rename from openhands/runtime/utils/shutdown_listener.pyrename to openhands/utils/shutdown_listener.pydiff --git a/openhands/utils/tenacity_stop.py b/openhands/utils/tenacity_stop.pyindex 48fdead866..d9aa83a613 100644--- a/openhands/utils/tenacity_stop.py+++ b/openhands/utils/tenacity_stop.py@@ -1,7 +1,7 @@from tenacity import RetryCallStatefrom tenacity.stop import stop_base-from openhands.runtime.utils.shutdown_listener import should_exit+from openhands.utils.shutdown_listener import should_exitclass stop_if_should_exit(stop_base):