Start the run_r worker with R's default packages - #213
Merged
Merged
Conversation
A supervised worker is a bare callr::r_session with only base plus callr's tools attached, so utils/stats/methods helpers (str, tail, head, setNames, capture.output) were missing, unlike in-process run_r. Set R_DEFAULT_PACKAGES for the worker so both run_r_modes share the same base environment; a host that sets it in run_r_worker_options$env still wins.
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.
A supervised
run_rworker (run_r_mode = "worker") is a barecallr::r_session, which starts R with onlybaseplus callr's own tools onthe search path. So common helpers from
utils/stats/methods(str,tail,head,setNames,capture.output, ...) are missing, unlikein-process
run_r, which inherits the front end's default packages.This sets
R_DEFAULT_PACKAGESto R's normal default set in the worker'ssession options so both
run_r_modes see the same base environment. A hostthat sets
R_DEFAULT_PACKAGESitself (inrun_r_worker_options$env) stillwins.
Found while auditing a MazeBench campaign: the model's worker
run_rkeptfailing with
could not find function "str"/"tail"/"setNames"/"capture.output".R/run-r-worker.R: appendR_DEFAULT_PACKAGESto the worker optionsenv.has
str/tail/setNameson its search path.🤖 Generated with Claude Code