fix(interpreter): report file synchronization failures - #71
Draft
isaacbmiller wants to merge 1 commit into
Draft
Conversation
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.
1. Issue / repro
PythonInterpreter can report successful execution even when it fails to copy a sandbox file back to the host.
On
main, this returns an empty successful result while the host file still containsoriginal_content. The sandbox mutation could not be synchronized, but the caller has no way to know.2. Why this is the root cause
Execution results are acknowledged JSON-RPC requests, but file synchronization is a fire-and-forget notification:
The runner then explicitly discards failures:
Python returns the execution result before learning whether the requested persistent side effect succeeded.
3. How we know the fix addresses the root cause
The regression mounts a real temporary file, deletes its virtual sandbox copy, and then lets normal post-execution synchronization run.
Untouched
mainat24ec85de4prints:This branch raises
CodeInterpreterErrorcontainingFailed to sync file, and the assertion confirms that the original host file remains unchanged.The full PythonInterpreter suite passes through the real Deno/Pyodide runner after the protocol change.
4. Why this is the concise fix
The existing request helper already writes a JSON-RPC request, waits for the matching response, validates its ID, and raises on an error response. File sync now uses that boundary:
The runner returns one matching success or error response. There is no retry, polling loop, filesystem fallback, or second synchronization protocol.
5. Context needed to validate the change
For each configured write path, PythonInterpreter:
sync_files=True.Step 3 is part of the observable result of
execute(). A successful Python expression is not a successful interpreter operation when its requested host-side file changes were lost.The parent PR matters to RLM specifically: once sync failure becomes a bare
CodeInterpreterError, #68 ensures RLM propagates it rather than treating it as model-correctable Python.6. What the fix does in the code
sync_fileoperation as an acknowledged JSON-RPC request.{synced: virtualPath}after a successful write.Compatibility boundaries and downsides
execute()now waits for each file's acknowledgment. This adds small synchronization latency in exchange for knowing whether persistence succeeded.deno_commandimplementing DSPy's runner protocol must respond tosync_filerequests. The bundled runner is updated in the same commit.sync_files=Falseis unchanged: no synchronization request is sent.Validation
uv run --frozen pytest -q tests/primitives/test_python_interpreter.py --denoon the stacked branch —55 passedmain— returns''and leavesoriginal_content; this branch raises