8000
Skip to content

fix(interpreter): reset tools/mounts when Deno subprocess restarts - #9351

Merged
isaacbmiller merged 3 commits into
mainfrom
isaac/rlm-deno-restart-fix
Mar 3, 2026
Merged

fix(interpreter): reset tools/mounts when Deno subprocess restarts#9351
isaacbmiller merged 3 commits into
mainfrom
isaac/rlm-deno-restart-fix

Conversation

@isaacbmiller
@isaacbmiller isaacbmiller commented Feb 28, 2026
Copy link
Copy Markdown
Collaborator

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

@isaacbmiller
isaacbmiller force-pushed the isaac/rlm-deno-restart-fix branch from dc8adad to 6155b7c Compare February 28, 2026 02:34
When _ensure_deno_process spawns a new process, reset _tools_registered
and _mounted_files so tools and file mounts replay automatically.
@isaacbmiller
isaacbmiller force-pushed the isaac/rlm-deno-restart-fix branch from 6155b7c to d9d7049 Compare February 28, 2026 02:35
…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.
@isaacbmiller
isaacbmiller merged commit 295e2b3 into main Mar 3, 2026
12 checks passed
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.
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

0