Shell sandbox blocks /dev/null: every command with 2>/dev/null fails (Operation not permitted)
Description
Any shell command that redirects to /dev/null fails immediately with a permission error:
/bin/bash: line 1: /dev/null: Operation not permitted
This breaks a huge swathe of standard shell idioms (cmd 2>/dev/null, cmd >/dev/null, cmd &>/dev/null) and causes the agent to loop because its standard error-suppression fallback is always blocked.
Reproduction
From the orchestrator shell tool, run any of:
ls /nonexistent 2>/dev/null
find ~ -name '*.md' 2>/dev/null
cat /missing 2>&1 >/dev/null
All return exit code 1 with /bin/bash: line 1: /dev/null: Operation not permitted.
Commands without the redirect work fine:
ls ~/Desktop/ # exit 0, output returned ✓
ls ~/Documents/ # exit 0 or 141 (SIGPIPE), output returned ✓
Impact
- Direct cause of the shell-tool loop in #6617: agent retried every failed command with
2>/dev/nullsuppression, which always failed, producing an identical error on every step - Breaks
find,grep -r,rsync, and many other tools that route errors to /dev/null - Exit code 141 (SIGPIPE) on piped commands suggests the pipe buffer or sandbox has related constraints
Context
Observed in the macOS app sandbox during life-scenario QA (2026-09-24). The /dev/null device may be excluded from the app's sandbox file-access entitlements, or the shell's working-directory jail doesn't include access to /dev.
Related
- #6617 — the loop this directly caused
Shell sandbox blocks /dev/null causing permission errors for redirects, breaking many commands and causing agent loops.
Labelled priority: p1.
Picking this one up. The macOS side of this already got handled a while back, so what is left is the Linux jail, which never got the same exception — I will fix it in the project that owns the jail now and check it against a real Linux kernel rather than guessing.
Releasing this one — not because it is wrong, but because the fix I came to write would have been dead code, and the reason is worth recording.
There is no Landlock ruleset to patch at the current pin. tinybox-jail does carry a Linux backend, crates/tinybox-jail/src/linux.rs, and its ruleset grants writes only PathBeneath jail.root plus reads for jail.read_only — so on paper this report is exactly right and /dev/null is missing. But that file is never compiled. crates/tinybox-jail/src/lib.rs:48-54 declares only four modules:
pub mod detect;
pub mod jail;
pub mod noop;
pub mod registry;
// Platform backends are intentionally not compiled until they can preserve
// the workspace unsafe-code policy and enforce the public jail contract.
linux.rs, macos.rs and windows.rs have no mod declaration anywhere in the crate. detect::pick_backend therefore logs [cwd_jail] no OS sandbox available and returns an UnsupportedBackend unconditionally, and default_backend() is that.
Measured rather than inferred — Linux 6.12.76, cat /sys/kernel/security/lsm → capability,bpf,landlock, built with --features landlock:
default_backend -> name="unsupported" is_available=false
So at tinybox 534112b (the gitlink on main) the OS-level jail is inert on every platform, and the host says so honestly: sandbox/ops.rs logs [sandbox:local] OS backend unavailable, using noop and local_status_for_backend reports Inactive rather than Ready for the noop backend.
What that means for this report. The symptom was real when it was filed against 0.63.12, while the jail still lived in crates/openhuman-core/src/sandbox/cwd_jail/. #6636 fixed the macOS half there on 2026-09-25 by allowing the exact /dev/null literal while keeping the rest of /dev denied. The jail then moved into tinybox, which carried both platform files over in their parked state — so today the macOS carve-out is dead code too, and a shell command redirecting to /dev/null is not refused by anything, because nothing is enforcing a filesystem wall.
Why I am not just wiring the modules up. The comment above says what blocks it: the workspace sets unsafe_code = "forbid" (Cargo.toml:71), and the Landlock backend applies its ruleset in unsafe { cmd.pre_exec(...) } (linux.rs:93) — the only correct place for it, since the ruleset has to land in the child between fork and exec. Resolving that is a policy call for the owning project: either an allowance scoped to that one call, or a design that avoids pre_exec. Not something to decide inside a /dev/null bug fix, and a host-side workaround is the wrong direction.
Suggested disposition: keep this open but re-point it at the Linux backend, or fold it into whatever tracks un-parking the platform backends, with the /dev/null literal included when linux.rs is first compiled so Linux lands with the exception macOS already has. Happy to take it then, or to take the wiring itself if a maintainer says which way the unsafe question should go.
Triage: valid — Current review confirms this is a concrete, in-scope engineering issue or request: “Shell sandbox blocks /dev/null: every command with 2>/dev/null fails (Operation not permitted)”. No complete resolution is evident in current main.
Triage: needs opinion — “Shell sandbox blocks /dev/null: every command with 2>/dev/null fails (Operation not permitted)” needs a maintainer decision on product scope/priority or fresh reproduction evidence before its status can be settled. Please advise whether to pursue, narrow, or close it.
Triage correction: valid — Current review confirms “Shell sandbox blocks /dev/null: every command with 2>/dev/null fails (Operation not permitted)” is an actionable, in-scope gap; no complete resolution is evident in current main.
This is fixed on current main. #6636 allowed shell redirection to /dev/null on macOS, and since #6981 the sandbox allows it on every platform, so 2>/dev/null no longer fails with "Operation not permitted". If you still see it on a current build, please reopen with the platform and build number. Closing.