Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

refactor(sandbox): report local status from jail capabilities

Steven Enamakel4c5b33acebcd
diff --git a/crates/openhuman-core/src/sandbox/mod.rs b/crates/openhuman-core/src/sandbox/mod.rs
index efced610b8..105742b550 100644
--- a/crates/openhuman-core/src/sandbox/mod.rs
+++ b/crates/openhuman-core/src/sandbox/mod.rs
@@ -16,6 +16,7 @@
pub use tinybox_jail as cwd_jail;
pub mod docker;
pub mod grants;
+mod native_jail;
pub mod ops;
pub mod schemas;
pub mod types;
diff --git a/crates/openhuman-core/src/sandbox/ops.rs b/crates/openhuman-core/src/sandbox/ops.rs
index f6ec4b148a..6fbaf68654 100644
--- a/crates/openhuman-core/src/sandbox/ops.rs
+++ b/crates/openhuman-core/src/sandbox/ops.rs
@@ -10,7 +10,8 @@ use super::types::{
use crate::agent::harness::definition::SandboxMode;
use crate::agent::platform_shell;
use crate::config::{RuntimeConfig, SandboxBackend, SandboxConfig};
-use crate::sandbox::cwd_jail::{self, Jail, NoopBackend};
+#[cfg(test)]
+use crate::sandbox::cwd_jail;
use std::collections::HashMap;
use std::ffi::OsString;
use std::path::{Path, PathBuf};
@@ -211,20 +212,14 @@ pub fn resolve_sandbox_policy(
/// depends on whether the machine has an OS jail, so on a host with Seatbelt or
/// Landlock the noop path is never reached and a regression to "always Ready"
/// passes unnoticed. That is exactly how the original defect survived.
-pub(crate) fn local_status_for_backend(backend_name: &str) -> SandboxStatus {
- if backend_name == cwd_jail::NOOP_BACKEND_NAME
- || backend_name == cwd_jail::detect::UNSUPPORTED_BACKEND_NAME
- {
- // The noop backend enforces nothing — it spawns the command as-is. The
- // `unsupported` backend is what `pick_backend` answers when no OS jail
- // is usable (no Landlock in the kernel, Windows, ...); it refuses to
- // spawn, and `execute_local_jail` then falls back to the noop backend,
- // so commands still run unconfined. Both are a documented passthrough
- // rather than a failure, so `Inactive` ("backend not initialized") is
- // the honest report, not `Error`.
- SandboxStatus::Inactive
- } else {
+pub(crate) fn local_status_for_jail(
+ available: bool,
+ suitable_for_untrusted_code: bool,
+) -> SandboxStatus {
+ if available && suitable_for_untrusted_code {
SandboxStatus::Ready
+ } else {
+ SandboxStatus::Inactive
}
}