Skip to content

Add per-tool output caps and run_r worker options - #211

Merged
TroyHernandez merged 2 commits into
mainfrom
mazebench-hooks
Sep 16, 2026
Merged

TroyHernandez merged 2 commits into
mainfrom
mazebench-hooks

Conversation

@TroyHernandez

Copy link
Copy Markdown
Contributor

Two small host hooks needed by the corteza MazeBench harness (and useful to any embedded host).

Per-tool output caps. config$tool_output_caps raises the universal 50-line / 5000-char tool-result cap for named tools whose results the model must see whole, keyed by tool name with max_chars and/or max_lines. Other tools keep the cap, a field left out keeps the tool's default budget (the read budget for read_file and friends), and a result past the raised cap still stashes to a handle. Validated once per handler so a malformed entry fails before any tool runs.

Why: a MazeBench board observation is about 80 lines. Under the universal cap the model saw only the top of every board in the first smoke runs ([tool output truncated] ... showing: first 40 lines). The ARC harness never hit this because its frame lived in an R binding with metadata-only tool text.

Worker process options. config$run_r_worker_options passes named arguments to callr::r_session_options() for the supervised run_r worker (env, libpath, cmdargs, arch). With arch, callr resolves the binary to R.home("bin")/<arch>/R, so a strict host can install a bubblewrap wrapper there and run only the model's R confined while the host process keeps its engine access. env replaces callr's default (TERM=dumb).

Tests: two new files (test_tool_output_caps_config.R, test_run_r_worker_options.R); full suite 4773 asserts green. Vignette configuration.md documents both keys.

config$tool_output_caps raises the universal 50-line / 5000-char tool
result cap for named tools whose results the model must see whole, keyed
by tool name with max_chars and/or max_lines. Other tools keep the cap and
a result past the raised cap still stashes to a handle.

config$run_r_worker_options passes named arguments to
callr::r_session_options() for the supervised run_r worker (env, libpath,
cmdargs, arch), so a strict host can run only the model's R under a
sandbox wrapper at R.home("bin")/<arch>/R while the host stays put.
@TroyHernandez
TroyHernandez merged commit 68e6973 into main Sep 16, 2026
2 checks passed
@TroyHernandez
TroyHernandez deleted the mazebench-hooks branch September 16, 2026 16:10
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