π OpenHands: AI-Driven Development
(fix) Revert #3233; more logging in runtimes (#3236)
tobitegeabec52abfe45
diff --git a/opendevin/runtime/client/runtime.py b/opendevin/runtime/client/runtime.pyindex f4782756b9..bb5cf0713b 100644--- a/opendevin/runtime/client/runtime.py+++ b/opendevin/runtime/client/runtime.py@@ -1,5 +1,4 @@import asyncio-import copyimport osimport tempfileimport uuid@@ -50,7 +49,6 @@ class EventStreamRuntime(Runtime):plugins: list[PluginRequirement] | None = None,container_image: str | None = None,):- self.config = copy.deepcopy(config)super().__init__(config, event_stream, sid, plugins) # will initialize the event stream@@ -72,6 +70,7 @@ class EventStreamRuntime(Runtime):self.container = Noneself.action_semaphore = asyncio.Semaphore(1) # Ensure one action at a time+ logger.debug(f'EventStreamRuntime `{sid}` config:\n{self.config}')async def ainit(self, env_vars: dict[str, str] | None = None):if self.config.sandbox.od_runtime_extra_deps:@@ -151,8 +150,6 @@ class EventStreamRuntime(Runtime):)volumes = None- logger.info(f'run_as_devin: `{self.config.run_as_devin}`')-if self.config.sandbox.browsergym_eval_env is not None:browsergym_arg = (f'--browsergym-eval-env {self.config.sandbox.browsergym_eval_env}'diff --git a/opendevin/runtime/runtime.py b/opendevin/runtime/runtime.pyindex abef411999..dc6b57c8dd 100644--- a/opendevin/runtime/runtime.py+++ b/opendevin/runtime/runtime.py@@ -70,6 +70,7 @@ class Runtime:self.config = copy.deepcopy(config)self.DEFAULT_ENV_VARS = _default_env_vars(config.sandbox)atexit.register(self.close_sync)+ logger.debug(f'Runtime `{sid}` config:\n{self.config}')async def ainit(self, env_vars: dict[str, str] | None = None) -> None:"""diff --git a/opendevin/runtime/server/runtime.py b/opendevin/runtime/server/runtime.pyindex 03f77d6245..7bdeb616f1 100644--- a/opendevin/runtime/server/runtime.py+++ b/opendevin/runtime/server/runtime.py@@ -52,6 +52,7 @@ class ServerRuntime(Runtime):self.sandbox = sandboxself._is_external_sandbox = Trueself.browser: BrowserEnv | None = None+ logger.debug(f'ServerRuntime `{sid}` config:\n{self.config}')def create_sandbox(self, sid: str = 'default', box_type: str = 'ssh') -> Sandbox:if box_type == 'local':diff --git a/tests/unit/test_runtime.py b/tests/unit/test_runtime.pyindex 180a844ecd..174c28689c 100644--- a/tests/unit/test_runtime.py+++ b/tests/unit/test_runtime.py@@ -962,13 +962,16 @@ DO NOT re-run the same failed edit command. Running it again will lead to the sa@pytest.mark.asyncio-async def test_ipython_agentskills_fileop_pwd(temp_dir, box_class, enable_auto_lint):+async def test_ipython_agentskills_fileop_pwd(+ temp_dir, box_class, run_as_devin, enable_auto_lint+):"""Make sure that cd in bash also update the current working directory in ipython."""runtime = await _load_runtime(- temp_dir, box_class, enable_auto_lint=enable_auto_lint+ temp_dir, box_class, run_as_devin, enable_auto_lint=enable_auto_lint)await _test_ipython_agentskills_fileop_pwd_impl(runtime, enable_auto_lint)+await runtime.close()await asyncio.sleep(1)@@ -1039,10 +1042,6 @@ async def test_ipython_agentskills_fileop_pwd_with_userdir(temp_dir, box_class):await asyncio.sleep(1)- TEST_RUNTIME.lower() == 'eventstream',- reason='Skip this if we want to test EventStreamRuntime',-)@pytest.mark.skipif(os.environ.get('TEST_IN_CI', 'false').lower() == 'true',# FIXME: There's some weird issue with the CI environment.@@ -1050,18 +1049,24 @@ async def test_ipython_agentskills_fileop_pwd_with_userdir(temp_dir, box_class):)@pytest.mark.asyncioasync def test_ipython_agentskills_fileop_pwd_agnostic_sandbox(- temp_dir, enable_auto_lint, container_image+ temp_dir, box_class, run_as_devin, enable_auto_lint, container_image):- """Make sure that cd in bash also update the current working directory in ipython."""+ """Make sure that cd in bash also updates the current working directory in iPython."""++ # NOTE: we only test for ServerRuntime, since EventStreamRuntime+ # is image agnostic by design.+ if box_class != 'server':+ pytest.skip('Skip this if box_class is not server')runtime = await _load_runtime(temp_dir,- # NOTE: we only test for ServerRuntime, since EventStreamRuntime is image agnostic by design.- ServerRuntime,+ box_class,+ run_as_devin,enable_auto_lint=enable_auto_lint,container_image=container_image,)await _test_ipython_agentskills_fileop_pwd_impl(runtime, enable_auto_lint)+await runtime.close()await asyncio.sleep(1)