fix(interpreter): reset tools/mounts when Deno subprocess restarts - #9351
Merged
Conversation
isaacbmiller
force-pushed
the
isaac/rlm-deno-restart-fix
branch
from
February 28, 2026 02:34
dc8adad to
6155b7c
Compare
When _ensure_deno_process spawns a new process, reset _tools_registered and _mounted_files so tools and file mounts replay automatically.
isaacbmiller
force-pushed
the
isaac/rlm-deno-restart-fix
branch
from
February 28, 2026 02:35
6155b7c to
d9d7049
Compare
…t-fix # Conflicts: # tests/primitives/test_python_interpreter.py
…r handler _ensure_deno_process() already resets _tools_registered and _mounted_files when it detects a dead process, making the explicit resets in the BrokenPipeError handler redundant.
MaximeRivest
pushed a commit
to MaximeRivest/dspy
that referenced
this pull request
Mar 5, 2026
…tanfordnlp#9351) * fix(interpreter): reset tools/mounts when Deno subprocess restarts When _ensure_deno_process spawns a new process, reset _tools_registered and _mounted_files so tools and file mounts replay automatically. * refactor(interpreter): remove redundant flag resets in BrokenPipeError handler _ensure_deno_process() already resets _tools_registered and _mounted_files when it detects a dead process, making the explicit resets in the BrokenPipeError handler redundant.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PythonInterpreter runs user code in a sandboxed Deno subprocess. On first use, it registers tools and mounts files, then sets _tools_registered and _mounted_files to skip re-doing that work. If the subprocess dies, _ensure_deno_process() spawns a new one — but the new process has no knowledge of previous registrations.
Previously, these flags were only reset inside one specific crash path (the BrokenPipeError handler in execute()). If the process died between calls, _ensure_deno_process() would spawn a fresh process but the flags would still be True, silently skipping tool/mount setup.
This PR moves the flag resets into _ensure_deno_process() itself python_interpreter.py:318-320, so they are cleared on every process respawn regardless of how the old one died.
cc @dbreunig