Skip to content

Commit abec52a

Browse files
authored
(fix) Revert #3233; more logging in runtimes (#3236)
* ServerRuntime: config copy in init * revert #3233 but more logging * get_box_classes: reset order back to previous version * 3 logging commands switched to debug (were info) * runtimes debug output of config on initialization * removed unneeded logger message from _init_container
1 parent 6a12a9f commit abec52a

File tree

4 files changed

+18
-14
lines changed

4 files changed

+18
-14
lines changed

opendevin/runtime/client/runtime.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import asyncio
2-
import copy
32
import os
43
import tempfile
54
import uuid
@@ -50,7 +49,6 @@ def __init__(
5049
plugins: list[PluginRequirement] | None = None,
5150
container_image: str | None = None,
5251
):
53-
self.config = copy.deepcopy(config)
5452
super().__init__(
5553
config, event_stream, sid, plugins
5654
) # will initialize the event stream
@@ -72,6 +70,7 @@ def __init__(
7270

7371
self.container = None
7472
self.action_semaphore = asyncio.Semaphore(1) # Ensure one action at a time
73+
logger.debug(f'EventStreamRuntime `{sid}` config:\n{self.config}')
7574

7675
async def ainit(self, env_vars: dict[str, str] | None = None):
7776
if self.config.sandbox.od_runtime_extra_deps:
@@ -151,8 +150,6 @@ async def _init_container(
151150
)
152151
volumes = None
153152

154-
logger.info(f'run_as_devin: `{self.config.run_as_devin}`')
155-
156153
if self.config.sandbox.browsergym_eval_env is not None:
157154
browsergym_arg = (
158155
f'--browsergym-eval-env {self.config.sandbox.browsergym_eval_env}'

opendevin/runtime/runtime.py

+1
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ def __init__(
7070
self.config = copy.deepcopy(config)
7171
self.DEFAULT_ENV_VARS = _default_env_vars(config.sandbox)
7272
atexit.register(self.close_sync)
73+
logger.debug(f'Runtime `{sid}` config:\n{self.config}')
7374

7475
async def ainit(self, env_vars: dict[str, str] | None = None) -> None:
7576
"""

opendevin/runtime/server/runtime.py

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ def __init__(
5252
self.sandbox = sandbox
5353
self._is_external_sandbox = True
5454
self.browser: BrowserEnv | None = None
55+
logger.debug(f'ServerRuntime `{sid}` config:\n{self.config}')
5556

5657
def create_sandbox(self, sid: str = 'default', box_type: str = 'ssh') -> Sandbox:
5758
if box_type == 'local':

tests/unit/test_runtime.py

+15-10
Original file line numberDiff line numberDiff line change
@@ -962,13 +962,16 @@ async def _test_ipython_agentskills_fileop_pwd_impl(
962962

963963

964964
@pytest.mark.asyncio
965-
async def test_ipython_agentskills_fileop_pwd(temp_dir, box_class, enable_auto_lint):
965+
async def test_ipython_agentskills_fileop_pwd(
966+
temp_dir, box_class, run_as_devin, enable_auto_lint
967+
):
966968
"""Make sure that cd in bash also update the current working directory in ipython."""
967969

968970
runtime = await _load_runtime(
969-
temp_dir, box_class, enable_auto_lint=enable_auto_lint
971+
temp_dir, box_class, run_as_devin, enable_auto_lint=enable_auto_lint
970972
)
971973
await _test_ipython_agentskills_fileop_pwd_impl(runtime, enable_auto_lint)
974+
972975
await runtime.close()
973976
await asyncio.sleep(1)
974977

@@ -1039,29 +1042,31 @@ async def test_ipython_agentskills_fileop_pwd_with_userdir(temp_dir, box_class):
10391042
await asyncio.sleep(1)
10401043

10411044

1042-
@pytest.mark.skipif(
1043-
TEST_RUNTIME.lower() == 'eventstream',
1044-
reason='Skip this if we want to test EventStreamRuntime',
1045-
)
10461045
@pytest.mark.skipif(
10471046
os.environ.get('TEST_IN_CI', 'false').lower() == 'true',
10481047
# FIXME: There's some weird issue with the CI environment.
10491048
reason='Skip this if in CI.',
10501049
)
10511050
@pytest.mark.asyncio
10521051
async def test_ipython_agentskills_fileop_pwd_agnostic_sandbox(
1053-
temp_dir, enable_auto_lint, container_image
1052+
temp_dir, box_class, run_as_devin, enable_auto_lint, container_image
10541053
):
1055-
"""Make sure that cd in bash also update the current working directory in ipython."""
1054+
"""Make sure that cd in bash also updates the current working directory in iPython."""
1055+
1056+
# NOTE: we only test for ServerRuntime, since EventStreamRuntime
1057+
# is image agnostic by design.
1058+
if box_class != 'server':
1059+
pytest.skip('Skip this if box_class is not server')
10561060

10571061
runtime = await _load_runtime(
10581062
temp_dir,
1059-
# NOTE: we only test for ServerRuntime, since EventStreamRuntime is image agnostic by design.
1060-
ServerRuntime,
1063+
box_class,
1064+
run_as_devin,
10611065
enable_auto_lint=enable_auto_lint,
10621066
container_image=container_image,
10631067
)
10641068
await _test_ipython_agentskills_fileop_pwd_impl(runtime, enable_auto_lint)
1069+
10651070
await runtime.close()
10661071
await asyncio.sleep(1)
10671072

0 commit comments

Comments
 (0)