Skip to content

fix(rlm): fall back to no sub-agents when the interpreter rejects the facade shim with SyntaxError - #10625

Merged
isaacbmiller merged 1 commit into
mainfrom
3.4.1/rlm-facade-syntaxerror
Oct 12, 2026
Merged

isaacbmiller merged 1 commit into
mainfrom
3.4.1/rlm-facade-syntaxerror

Conversation

@isaacbmiller

Copy link
Copy Markdown
Collaborator

📝 Changes Description

Since #10478, RLM runs the sandbox dspy facade 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 raise SyntaxError. _setup_facade only caught CodeExecutionError around FacadeInvocation.install, so every RLM call on these interpreters crashed. 3.4.0 works with them.

This PR:

  • catches SyntaxError in _setup_facade and handles it like CodeExecutionError: it removes the facade tools, logs the existing RLM sub-agents are unavailable on <Interpreter> warning, and runs the call without sub-agents.
  • adds a regression test (TestRLMSubAgents::test_interpreter_that_rejects_the_shim_as_syntax_error_runs_without_sub_agents). It fails on main with SyntaxError: "_dspy_sys" is an invalid variable name… and passes with the fix.

A SyntaxError from 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.
  • A RestrictedPython-backed CodeInterpreter crashed before the fix. After it, RLM completes both with DummyLM and with a live gpt-4o.

✅ Contributor Checklist

  • Pre-Commit checks are passing (locally and remotely)
  • Title of your PR / MR corresponds to the required format
  • Commit message follows required format {label}(dspy): {message}

⚠️ Warnings

Targeted for 3.4.1. Sibling 3.4.1 fixes R3 (Flex in-process interpreters) and R7 (facade opt-out) also touch rlm.py and the facade. This diff only changes the except clause in _setup_facade.

@greptile-apps

greptile-apps Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium impact] The changes are safe to merge, with no outstanding issues requiring attention.

Summary

RLM now continues without sub-agents when an interpreter rejects the facade shim with SyntaxError.

  • RLM calls continue when an interpreter rejects the facade shim.

Reviews (2) · Last reviewed commit: "fix(rlm): fall back to no sub-agents whe..." · Reviewed by Greptile

… 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
isaacbmiller force-pushed the 3.4.1/rlm-facade-syntaxerror branch from c7825a6 to 1ae4596 Compare October 12, 2026 16:39
@isaacbmiller
isaacbmiller merged commit 1dcdf86 into main Oct 12, 2026
26 checks passed
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.

2 participants