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: keep Windows bootstrap env host-only
Steven Enamakel5ca37fdec931
diff --git a/crates/openhuman-cli/Cargo.toml b/crates/openhuman-cli/Cargo.tomlindex 0450166998..24c80d722b 100644--- a/crates/openhuman-cli/Cargo.toml+++ b/crates/openhuman-cli/Cargo.toml@@ -199,14 +199,6 @@ path = "../../tests/cwd_jail_e2e.rs"name = "windows_sandbox_env_e2e"path = "../../tests/windows_sandbox_env_e2e.rs"-[[test]]-name = "domain_modules_e2e"-path = "../../tests/in_process/domain_modules_e2e.rs"--[[test]]-name = "embeddings_rpc_e2e"-path = "../../tests/in_process/embeddings_rpc_e2e.rs"-[[test]]name = "inference_provider_e2e"path = "../../tests/inference_provider_e2e.rs"diff --git a/crates/openhuman-core/src/agent/platform_shell.rs b/crates/openhuman-core/src/agent/platform_shell.rsindex 01dc475baa..59793af3bf 100644--- a/crates/openhuman-core/src/agent/platform_shell.rs+++ b/crates/openhuman-core/src/agent/platform_shell.rs@@ -56,8 +56,8 @@ use std::path::Path;/// installers and SDK locators probe them.////// Single source of truth: keep every launcher's allow-list a superset of this-/// (enforced by `windows_bootstrap_vars_are_forwarded_everywhere`), and add a-/// launcher to that test rather than inventing a sixth list.+/// (enforced by the launcher unit tests), and add a launcher to those tests+/// rather than inventing a sixth list.pub const WINDOWS_PROCESS_ENV_VARS: &[&str] = &["SystemRoot","WINDIR",@@ -96,6 +96,7 @@ pub fn assert_forwards_windows_bootstrap(allowlist: &[&str], launcher: &str) {/// Add Windows bootstrap variables to a host child. Keep these out of the/// sandbox policy because that policy is also forwarded into Linux containers.+#[cfg(windows)]pub fn forward_windows_bootstrap_env(cmd: &mut tokio::process::Command) {for var in WINDOWS_PROCESS_ENV_VARS {if let Ok(val) = std::env::var(var) {@@ -104,6 +105,21 @@ pub fn forward_windows_bootstrap_env(cmd: &mut tokio::process::Command) {}}+#[cfg(not(windows))]+pub fn forward_windows_bootstrap_env(_cmd: &mut tokio::process::Command) {}++#[cfg(windows)]+pub fn forward_windows_bootstrap_env_std(cmd: &mut std::process::Command) {+ for var in WINDOWS_PROCESS_ENV_VARS {+ if let Ok(val) = std::env::var(var) {+ cmd.env(var, val);+ }+ }+}++#[cfg(not(windows))]+pub fn forward_windows_bootstrap_env_std(_cmd: &mut std::process::Command) {}+/// Whether the Unix arm prefixes `set -o pipefail`.#[derive(Clone, Copy, PartialEq, Eq)]enum PipeFail {diff --git a/crates/openhuman-core/src/sandbox/ops.rs b/crates/openhuman-core/src/sandbox/ops.rsindex 99ed1fd713..f1588b6c00 100644--- a/crates/openhuman-core/src/sandbox/ops.rs+++ b/crates/openhuman-core/src/sandbox/ops.rs@@ -29,14 +29,8 @@ use std::time::Duration;/// `npm_exec`, `python_exec`) each carry their own copy of the allow-list and/// had already been patched: the built-in `orchestrator` runs with/// `sandbox_mode = "sandboxed"`, and all four tools divert to-/// [`crate::sandbox`] *before* reaching those lists, so this was the only list-/// that mattered for the main agent. Keep it a superset of-/// [`crate::agent::platform_shell::WINDOWS_PROCESS_ENV_VARS`] —-/// `sandbox_env_forwards_windows_bootstrap_vars` and-/// `tests/windows_sandbox_env_e2e.rs` enforce that.-///-/// On Linux and macOS these names simply do not resolve in the parent-/// environment, so forwarding them is a no-op there.+/// [`crate::sandbox`] *before* reaching those lists, so the host spawn paths+/// below are the ones that must add the Windows-only bootstrap set.pub const SANDBOX_ENV_PASSTHROUGH: &[&str] = &["PATH", "HOME", "TERM", "LANG", "LC_ALL", "LC_CTYPE", "USER", "SHELL", "TMPDIR",];@@ -411,7 +405,7 @@ async fn execute_local_jail(cmd.env(var, val);}}- platform_shell::forward_windows_bootstrap_env(&mut cmd);+ platform_shell::forward_windows_bootstrap_env_std(&mut cmd);cmd.env("TMPDIR", &scratch.path);for (k, v) in extra_env {cmd.env(k, v);diff --git a/tests/windows_sandbox_env_e2e.rs b/tests/windows_sandbox_env_e2e.rsindex a7a8fad532..1dfdfc3799 100644--- a/tests/windows_sandbox_env_e2e.rs+++ b/tests/windows_sandbox_env_e2e.rs@@ -25,11 +25,10 @@ use std::time::Duration;use openhuman_core::agent::harness::definition::SandboxMode;use openhuman_core::config::RuntimeConfig;-use openhuman_core::sandbox::ops::{- execute_in_sandbox, resolve_sandbox_policy, SANDBOX_ENV_PASSTHROUGH,-};+use openhuman_core::sandbox::ops::{execute_in_sandbox, resolve_sandbox_policy};/// Run `command` through OpenHuman's sandbox execution path under `mode`.+#[cfg(windows)]async fn run_in_sandbox(mode: SandboxMode,command: &str,@@ -53,17 +52,6 @@ async fn run_in_sandbox(.unwrap_or_else(|e| panic!("execute_in_sandbox({mode:?}) failed to run the command: {e}"))}-/// Every allow-list that clears the child environment must cover the Windows-/// bootstrap set. Runs on every OS: the list is platform-independent by design,-/// and on Unix the extra names simply never resolve in the parent environment.-#[test]-fn sandbox_allowlist_covers_windows_bootstrap() {- openhuman_core::agent::platform_shell::assert_forwards_windows_bootstrap(- SANDBOX_ENV_PASSTHROUGH,- "sandbox::ops::SANDBOX_ENV_PASSTHROUGH",- );-}-#[cfg(windows)]fn env_probe_command() -> &'static str {"echo SR=[%SystemRoot%] TEMP=[%TEMP%] UP=[%USERPROFILE%] PATH=[%PATH%]"@@ -172,14 +160,14 @@ async fn node_crypto_runs_through_sandbox_path() {#[cfg(windows)]#[tokio::test]async fn powershell_runs_through_sandbox_path() {- if !tool_available("powershell") {- eprintln!("skipping powershell_runs_through_sandbox_path: `powershell` is not on PATH");+ if !tool_available("powershell.exe") {+ eprintln!("skipping powershell_runs_through_sandbox_path: `powershell.exe` is not on PATH");return;}let result = run_in_sandbox(SandboxMode::None,- "powershell -NoProfile -Command [guid]::NewGuid().ToString()",+ "powershell.exe -NoProfile -Command [guid]::NewGuid().ToString()",).await;@@ -210,7 +198,7 @@ async fn powershell_runs_through_sandbox_path() {#[cfg(windows)]fn tool_available(program: &str) -> bool {- let args = if program.eq_ignore_ascii_case("powershell") {+ let args = if program.eq_ignore_ascii_case("powershell.exe") {vec!["-NoProfile","-NonInteractive",