Skip to content

Fix async files operations#42

Merged
bchatelard merged 3 commits into
mainfrom
fix-async-files-operations
May 19, 2026
Merged

Fix async files operations#42
bchatelard merged 3 commits into
mainfrom
fix-async-files-operations

Conversation

@bchatelard
Copy link
Copy Markdown
Member

The bug: SandboxFilesystem.upload_file calls self.write_file() and download_file calls
self.read_file(). When these sync methods run in the executor thread via async_wrapper,
self is the AsyncSandboxFilesystem instance, so self.write_file() dispatches to the async
override and returns an unawaited coroutine.

The fix: call SandboxFilesystem.write_file(self, ...) and SandboxFilesystem.read_file(self,
...) explicitly so the sync methods always invoke the sync implementations, regardless of
which subclass self is.

The bug: SandboxFilesystem.upload_file calls self.write_file() and download_file calls
  self.read_file(). When these sync methods run in the executor thread via async_wrapper,
  self is the AsyncSandboxFilesystem instance, so self.write_file() dispatches to the async
  override and returns an unawaited coroutine.

  The fix: call SandboxFilesystem.write_file(self, ...) and SandboxFilesystem.read_file(self,
   ...) explicitly so the sync methods always invoke the sync implementations, regardless of
  which subclass self is.
@bchatelard bchatelard merged commit b91bf98 into main May 19, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant