Wire cwd_jail into shell, node_exec, and npm_exec tools
Summary
Wire cwd_jail::spawn into ShellTool, NodeExec, and NpmExec so shell-family tools run inside an OS-level jail (Landlock on Linux, Seatbelt on macOS) rooted at Config.action_dir — or, if jailing is deferred, explicitly document the path-hardening-only fallback in CLAUDE.md and the capability catalog.
Problem
#3051 acceptance criterion 3 ("Jailed execution") was the headline of the original request: "Shell-family tools run inside cwd_jail (or documented noop + path hardening on unsupported OS) with root = actions dir."
The implementing PR #3074 shipped the path-split and the in-Rust deny-list, but cwd_jail:: is never invoked from any tool: grep -r 'cwd_jail::' src/openhuman/tools/ returns zero hits. build_shell_command (src/openhuman/agent/host_runtime.rs:96) sets current_dir(action_dir) on a plain tokio::process::Command with no jail wrapper. Shell, node_exec, and npm_exec all go through the same code path.
The fallback in #3051 ("documented noop + path hardening on unsupported OS") would also be acceptable, but the noop is currently undocumented — a reader looking at cwd_jail/ and the PR body would reasonably assume the jail is wired.
Who it hurts: anyone relying on OS-level isolation as a defense against a runaway agent process. The Rust-side is_workspace_internal_path check is bypassed if a child process is spawned that reaches outside the action root via a path the parent never sees (symlink races, relative paths from a writable trusted-root, etc.). Landlock/Seatbelt closes that.
Solution (optional)
- Add a
cwd_jail::spawn-wrapped variant tohost_runtime::build_shell_command(or a sibling) that takes the action dir as the jail root and falls back to the plain command on unsupported platforms (current behavior ofcwd_jail::default_backend). - Route
ShellTool::run_with_security,NodeExec, andNpmExecthrough it.code_executorshould inherit automatically since it ends up at the sameshellinvocation. - If full wiring is out of scope for this iteration, land a short documentation block in
CLAUDE.mdunder "Command permission model" that names the gap, and call it out in the capability catalog (about_app).
Acceptance criteria
- [ ] Shell-family tools spawn through
cwd_jail—ShellTool,NodeExec,NpmExecuse a jail-aware spawn helper rooted atsecurity.action_dir. - [ ] Platform fallback documented — on platforms where
cwd_jailis a noop, the path-hardening fallback is documented inCLAUDE.mdand surfaced in the capability catalog. - [ ] Tests — Rust test that asserts a jailed shell process cannot
cata file outsideaction_dir(on a platform where the jail backend is active in CI), plus a unit test that the noop backend is the one selected on unsupported OS. - [ ] Diff coverage ≥ 80% — the implementing PR meets the changed-lines coverage gate (Vitest + cargo-llvm-cov, enforced by
.github/workflows/pr-ci.yml).