Skip to content

workflow: rework sandboxing of sys.modules#144

Open
msullivan wants to merge 1 commit into
mainfrom
new-sandbox
Open

workflow: rework sandboxing of sys.modules#144
msullivan wants to merge 1 commit into
mainfrom
new-sandbox

Conversation

@msullivan

Copy link
Copy Markdown
Contributor

The handling of sys.modules for sandboxes was not concurrency safe,
which is a problem because every queue request is handled in a
separate thread.

Instead of trying to do these big manipulations of sys.modules, follow
what Temporal does and install a proxying sys.modules shim that allows
each context to have its own set of imported modules.

This allows workflows to be run in fresh module environments where we
can ensure that everything is intercepted by the sandbox and that
won't have any interference with or from steps, while allowing steps
to run without needing to interact with proxy modules.

@msullivan msullivan requested review from 1st1 and fantix June 24, 2026 00:58
@vercel

vercel Bot commented Jun 24, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
vercel-py Ready Ready Preview Jun 24, 2026 5:45pm

Request Review

The handling of sys.modules for sandboxes was not concurrency safe,
which is a problem because every queue request is handled in a
separate thread.

Instead of trying to do these big manipulations of sys.modules, follow
what Temporal does and install a proxying sys.modules shim that allows
each context to have its own set of imported modules.

This allows workflows to be run in fresh module environments where we
can ensure that everything is intercepted by the sandbox and that
won't have any interference with or from steps, while allowing steps
to run without needing to interact with proxy modules.
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