Skip to content

feat(exec): add command_wrapper for sandbox support#2684

Draft
chengyongru wants to merge 1 commit intomainfrom
feat/cmd_wrapper
Draft

feat(exec): add command_wrapper for sandbox support#2684
chengyongru wants to merge 1 commit intomainfrom
feat/cmd_wrapper

Conversation

@chengyongru
Copy link
Copy Markdown
Collaborator

Summary

  • Add tools.exec.commandWrapper config option to wrap shell commands in a user-defined template before execution
  • Supports {command} and {cwd} placeholders with plain string replacement
  • Safety guard runs before wrapper substitution
  • Add docs/COMMAND_WRAPPER.md with sandbox examples (bubblewrap, firejail, nsjail) and caveats

Test plan

  • test_exec_command_wrapper_applied — wrapper correctly wraps command
  • test_exec_command_wrapper_with_cwd{cwd} substituted with absolute path
  • test_exec_command_wrapper_empty_noop — empty string is backward compatible
  • test_exec_command_wrapper_guard_runs_before_wrapper — guard runs before wrapper
  • test_exec_command_wrapper_ignores_unknown_placeholders — no KeyError on typos
  • test_exec_command_wrapper_does_not_leak_attributes — no Python introspection
  • All 45 tests in test_tool_validation.py pass

Allow users to wrap shell commands in a sandbox (e.g. bubblewrap,
firejail, nsjail) via config, without nanobot baking in any sandbox
backend. The template supports {command} and {cwd} placeholders with
plain string replacement.
@chengyongru chengyongru marked this pull request as draft March 31, 2026 15:49
@chengyongru chengyongru changed the base branch from nightly to main March 31, 2026 15:49
@chengyongru
Copy link
Copy Markdown
Collaborator Author

mark: #1940

@afshinm
Copy link
Copy Markdown

afshinm commented Apr 1, 2026

Hi @chengyongru, I built Zerobox which is a cross platform process sandboxing written in Rust: https://github.com/afshinm/zerobox. Would it be possible to have Zerobox as an example as well? I'm more than happy to add nanoclaw specific profiles (HN thread https://news.ycombinator.com/item?id=47607742)

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