Repository navigation
fix(rlm): fall back to no sub-agents when the interpreter rejects the facade shim with SyntaxError - #10625
Merged
Conversation
Merged
3 tasks done
Contributor
|
… facade shim with SyntaxError Restricted interpreters (e.g. RestrictedPython) reject the shim's _dspy_* names at compile time and raise SyntaxError, which _setup_facade did not catch, so every RLM call crashed before the first iteration. Treat it like CodeExecutionError. Amp-Thread-ID: https://ampcode.com/threads/T-01a12205-9d20-7108-b7b8-057a602a6ba2 Co-authored-by: Isaac Miller <isaac@cmpnd.ai>
isaacbmiller
force-pushed
the
3.4.1/rlm-facade-syntaxerror
branch
from
October 12, 2026 16:39
c7825a6 to
1ae4596
Compare
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.
📝 Changes Description
Since #10478, RLM runs the sandbox
dspyfacade shim (_facade_shim.py) through every interpreter before the first iteration. Restricted interpreters, such as one built on RestrictedPython, reject the shim's_dspy_*names at compile time and raiseSyntaxError._setup_facadeonly caughtCodeExecutionErroraroundFacadeInvocation.install, so every RLM call on these interpreters crashed. 3.4.0 works with them.This PR:
SyntaxErrorin_setup_facadeand handles it likeCodeExecutionError: it removes the facade tools, logs the existingRLM sub-agents are unavailable on <Interpreter>warning, and runs the call without sub-agents.TestRLMSubAgents::test_interpreter_that_rejects_the_shim_as_syntax_error_runs_without_sub_agents). It fails on main withSyntaxError: "_dspy_sys" is an invalid variable name…and passes with the fix.A
SyntaxErrorfrom the model's own code still goes through the REPL loop's existing handling.Verification:
pytest tests/predict/test_rlm.py tests/primitives/ tests/flex/: 390 passed, 161 skipped.CodeInterpretercrashed before the fix. After it, RLM completes both withDummyLMand with a live gpt-4o.✅ Contributor Checklist
Targeted for 3.4.1. Sibling 3.4.1 fixes R3 (Flex in-process interpreters) and R7 (facade opt-out) also touch
rlm.pyand the facade. This diff only changes the except clause in_setup_facade.