8000
Skip to content

fix(RLM): large variable injection - #9233

Merged
isaacbmiller merged 3 commits into
mainfrom
isaac/rlm-async-debug
Jan 23, 2026
Merged

fix(RLM): large variable injection#9233
isaacbmiller merged 3 commits into
mainfrom
isaac/rlm-async-debug

Conversation

@isaacbmiller
@isaacbmiller isaacbmiller commented Jan 23, 2026
Copy link
Copy Markdown
Collaborator

Pyodide's FFI (Foreign Function Interface) crashes when passing strings larger than 128MB between JavaScript and Python. This PR adds filesystem-based injection for large variables to work around this limit.

Before: All variables were embedded directly in Python code:
code = f"data = {repr(large_string)}\n" + code
After: Variables over 100MB are written to Pyodide's virtual filesystem and loaded via json.loads():

# Host writes JSON to /tmp/dspy_vars/data.json
# Generated code:
data = json.loads(
    open('/tmp/dspy_vars/data.json').read()
)

The PR also extracts a _send_request helper to deduplicate JSON-RPC request/response handling, which is reused by the new inject_var RPC method.

@isaacbmiller
isaacbmiller marked this pull request as ready for review January 23, 2026 21:12
@isaacbmiller
Copy link
Copy Markdown
Collaborator Author

@codex

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 15a4ee8a72

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread dspy/primitives/python_interpreter.py
@isaacbmiller
Copy link
Copy Markdown
Collaborator Author

approved offline

@isaacbmiller
isaacbmiller merged commit 815f92a into main Jan 23, 2026
12 checks passed
@isaacbmiller
isaacbmiller deleted the isaac/rlm-async-debug branch January 23, 2026 22:51
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