The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
fix(sandbox): correct sandbox operation ordering in ops module
Steven Enamakeld859b3541759
diff --git a/crates/openhuman-core/src/sandbox/ops.rs b/crates/openhuman-core/src/sandbox/ops.rsindex 226fd1008e..84a0d60806 100644--- a/crates/openhuman-core/src/sandbox/ops.rs+++ b/crates/openhuman-core/src/sandbox/ops.rs@@ -21,6 +21,27 @@ pub const SANDBOX_ENV_PASSTHROUGH: &[&str] = &["PATH", "HOME", "TERM", "LANG", "LC_ALL", "LC_CTYPE", "USER", "SHELL", "TMPDIR",];+/// Host switch that turns the agent sandbox off for the whole process.+///+/// For hosts that already isolate the core (a container, a CI or benchmark+/// task image, a VM): the OS jail confines commands to the action dir, which+/// breaks work such as installing packages or editing `/etc` that the outer+/// isolation already permits. `off`, `none`, `0`, `false` or `disabled`+/// (case-insensitive) disable it; anything else, or unset, leaves it on.+pub const SANDBOX_OFF_ENV: &str = "OPENHUMAN_SANDBOX";++/// Whether `value` (the `OPENHUMAN_SANDBOX` setting) disables the sandbox.+pub fn sandbox_off_value(value: Option<&str>) -> bool {+ matches!(+ value.map(|v| v.trim().to_ascii_lowercase()).as_deref(),+ Some("off" | "none" | "0" | "false" | "disabled")+ )+}++fn sandbox_disabled_by_host() -> bool {+ sandbox_off_value(std::env::var(SANDBOX_OFF_ENV).ok().as_deref())+}+/// Resolve a `SandboxPolicy` from the agent's `SandboxMode`, the/// session origin, and the global runtime config.///@@ -40,6 +61,13 @@ pub fn resolve_sandbox_policy(let backend = match mode {SandboxMode::None => SandboxBackendKind::None,SandboxMode::ReadOnly => SandboxBackendKind::None,+ SandboxMode::Sandboxed if sandbox_disabled_by_host() => {+ tracing::debug!(+ env = SANDBOX_OFF_ENV,+ "[sandbox] host disabled the sandbox; running sandboxed mode unconfined"+ );+ SandboxBackendKind::None+ }SandboxMode::Sandboxed => {if runtime_config.kind == "docker" || is_remote_session {SandboxBackendKind::Dockerdiff --git a/crates/openhuman-core/src/sandbox/ops_tests.rs b/crates/openhuman-core/src/sandbox/ops_tests.rsindex fb59fa5c47..358c57d50c 100644--- a/crates/openhuman-core/src/sandbox/ops_tests.rs+++ b/crates/openhuman-core/src/sandbox/ops_tests.rs@@ -609,3 +609,17 @@ async fn local_handle_status_matches_the_backend_actually_in_force() {"backend = {name}");}++#[test]+fn sandbox_off_value_accepts_off_spellings() {+ for v in ["off", "OFF", " none ", "0", "false", "Disabled"] {+ assert!(sandbox_off_value(Some(v)), "{v:?} should disable the sandbox");+ }+}++#[test]+fn sandbox_off_value_keeps_sandbox_on_otherwise() {+ for v in [None, Some(""), Some("on"), Some("1"), Some("true"), Some("local")] {+ assert!(!sandbox_off_value(v), "{v:?} must leave the sandbox on");+ }+}