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
test: align shell env and timeout tests with sandbox allowlist
Steven Enamakelf3547030ca36
diff --git a/crates/openhuman-core/src/tools/impl/system/shell_tests_schema_and_env_tests.rs b/crates/openhuman-core/src/tools/impl/system/shell_tests_schema_and_env_tests.rsindex 83b9db21e8..9fb79f302d 100644--- a/crates/openhuman-core/src/tools/impl/system/shell_tests_schema_and_env_tests.rs+++ b/crates/openhuman-core/src/tools/impl/system/shell_tests_schema_and_env_tests.rs@@ -196,8 +196,8 @@ async fn shell_destructive_command_is_gated_not_run_inline() {/// fresh tempdir (distinct from `workspace_dir` and from `cwd`),/// runs `pwd`, and asserts the captured stdout canonicalises to the/// same path as `action_dir`. If `ShellTool::run_with_security`-/// stops passing `&security.action_dir` to `build_shell_command`-/// (or `build_shell_command` stops calling `current_dir`), this+/// stops passing `&security.action_dir` as the module request's working+/// directory, this/// test fails before the regression ships.#[cfg(not(windows))]#[tokio::test]@@ -241,8 +241,7 @@ async fn shell_pwd_returns_action_dir_not_workspace_dir() {expected,"pwd must report `action_dir`. got `{}`, expected `{}`. \If this fails, `ShellTool::run_with_security` likely stopped \- passing `&security.action_dir` to `runtime.build_shell_command`, \- or `build_shell_command` stopped calling `current_dir(...)`. See #3238.",+ passing `&security.action_dir` as the native shell request's cwd. See #3238.",actual.display(),expected.display(),);@@ -350,35 +349,22 @@ fn shell_output_limit_is_1mb() {#[test]fn shell_safe_env_vars_excludes_secrets() {- for var in SAFE_ENV_VARS {+ for var in crate::sandbox::ops::SANDBOX_ENV_PASSTHROUGH {let lower = var.to_lowercase();assert!(!lower.contains("key") && !lower.contains("secret") && !lower.contains("token"),- "SAFE_ENV_VARS must not include sensitive variable: {var}"+ "the shell environment allowlist must not include sensitive variable: {var}");}}#[test]fn shell_safe_env_vars_includes_essentials() {- assert!(- SAFE_ENV_VARS.contains(&"PATH"),- "PATH must be in safe env vars"- );- assert!(- SAFE_ENV_VARS.contains(&"HOME"),- "HOME must be in safe env vars"- );- assert!(- SAFE_ENV_VARS.contains(&"TERM"),- "TERM must be in safe env vars"- );-}--#[test]-fn shell_safe_env_vars_include_windows_process_essentials() {- crate::agent::platform_shell::assert_forwards_windows_bootstrap(- SAFE_ENV_VARS,- "shell::SAFE_ENV_VARS",- );+ let allowlist = crate::sandbox::ops::SANDBOX_ENV_PASSTHROUGH;+ for essential in ["PATH", "HOME", "TERM"] {+ assert!(+ allowlist.contains(&essential),+ "{essential} must be in the shell environment allowlist"+ );+ }}diff --git a/crates/openhuman-core/src/tools/timeout/mod_tests.rs b/crates/openhuman-core/src/tools/timeout/mod_tests.rsindex 16e578a646..e1db825cab 100644--- a/crates/openhuman-core/src/tools/timeout/mod_tests.rs+++ b/crates/openhuman-core/src/tools/timeout/mod_tests.rs@@ -185,6 +185,18 @@ fn resolve_effective_table() {}}+/// A shell child that leads its own process group and dies with its handle, as+/// the module-owned shell children do; the deadline helpers under test must+/// reach everything it starts.+#[cfg(unix)]+fn test_shell(command: &str) -> tokio::process::Command {+ let mut cmd = tokio::process::Command::new("sh");+ cmd.arg("-c").arg(command).kill_on_drop(true);+ own_process_group(cmd.as_std_mut());+ cmd+}++/// The deadline must take the command's whole process group with it. A shell/// pipeline is grandchildren of the tool's child, and a `grep -rl … /` the tool/// had reported as killed ran on for half an hour at a full core.@@ -196,7 +208,7 @@ async fn a_timed_out_command_takes_its_whole_process_group_with_it() {let pidfile = dir.join("grandchild.pid");// `sleep 30 &` is a grandchild in the shell's own process group; `wait`// keeps the shell alive past the deadline.- let mut cmd = crate::agent::platform_shell::build_tokio_command(&format!(+ let mut cmd = test_shell(&format!("sleep 30 & echo $! > {}; wait",pidfile.display()));@@ -242,7 +254,7 @@ async fn a_shell_family_child_dies_with_a_dropped_future() {let dir = std::env::temp_dir().join(format!("oh-dropkill-{}", std::process::id()));std::fs::create_dir_all(&dir).unwrap();let pidfile = dir.join("child.pid");- let mut cmd = crate::agent::platform_shell::build_tokio_command(&format!(+ let mut cmd = test_shell(&format!("echo $$ > {}; sleep 30",pidfile.display()));