From 2b0bb507fdf992ccb8516d9743b77fd31ccf5b42 Mon Sep 17 00:00:00 2001 From: "mendral-app[bot]" <233154221+mendral-app[bot]@users.noreply.github.com> Date: Wed, 10 Jun 2026 12:51:28 -0700 Subject: [PATCH 1/2] fix: make watch() async to ensure running event loop --- src/blaxel/core/sandbox/default/filesystem.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/blaxel/core/sandbox/default/filesystem.py b/src/blaxel/core/sandbox/default/filesystem.py index 5e87819..37d557d 100644 --- a/src/blaxel/core/sandbox/default/filesystem.py +++ b/src/blaxel/core/sandbox/default/filesystem.py @@ -377,7 +377,7 @@ async def cp(self, source: str, destination: str, max_wait: int = 180000) -> Cop return CopyResponse(message="Files copied", source=source, destination=destination) - def watch( + async def watch( self, path: str, callback: Callable[[WatchEvent], None], @@ -393,7 +393,7 @@ def watch( Or manually: - handle = sandbox.fs.watch(path, callback) + handle = await sandbox.fs.watch(path, callback) try: # do something finally: From 51b3d385bd174ad8f7d4689dd4ae5927b78529a9 Mon Sep 17 00:00:00 2001 From: "mendral-app[bot]" <233154221+mendral-app[bot]@users.noreply.github.com> Date: Wed, 10 Jun 2026 13:02:44 -0700 Subject: [PATCH 2/2] test: add await to watch() calls in integration tests --- tests/integration/core/sandbox/test_filesystem.py | 2 +- tests/integration/core/sandbox/test_sessions.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/integration/core/sandbox/test_filesystem.py b/tests/integration/core/sandbox/test_filesystem.py index 6206055..9587c16 100644 --- a/tests/integration/core/sandbox/test_filesystem.py +++ b/tests/integration/core/sandbox/test_filesystem.py @@ -388,7 +388,7 @@ def on_change(event): if event.name == "watched-file.txt": change_detected = True - handle = self.sandbox.fs.watch(dir_path, on_change) + handle = await self.sandbox.fs.watch(dir_path, on_change) try: await async_sleep(0.5) diff --git a/tests/integration/core/sandbox/test_sessions.py b/tests/integration/core/sandbox/test_sessions.py index 1ac54d7..fbce33a 100644 --- a/tests/integration/core/sandbox/test_sessions.py +++ b/tests/integration/core/sandbox/test_sessions.py @@ -180,7 +180,7 @@ def on_change(event): nonlocal change_detected change_detected = True - handle = sandbox_from_session.fs.watch("/", on_change) + handle = await sandbox_from_session.fs.watch("/", on_change) try: await async_sleep(0.5) # Wait for watch to be established await sandbox_from_session.fs.write("/session-test.txt", "content")