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
chore(test): replace manual env var management with locked guards
Steven Enamakel7dba561259fa
diff --git a/crates/openhuman-core/src/platform/service/restart_tests.rs b/crates/openhuman-core/src/platform/service/restart_tests.rsindex 2dae015675..71aa06667f 100644--- a/crates/openhuman-core/src/platform/service/restart_tests.rs+++ b/crates/openhuman-core/src/platform/service/restart_tests.rs@@ -105,7 +105,6 @@ fn restart_status_serializes() {#[test]fn apply_startup_restart_delay_from_env_noop_when_unset() {// Ensure the env var is not set, then call — should not block- let _prev = std::env::var(RESTART_DELAY_ENV).ok();- std::env::remove_var(RESTART_DELAY_ENV);+ let _env = crate::config::test_env::EnvVarGuard::locked_unset(RESTART_DELAY_ENV);apply_startup_restart_delay_from_env(); // should return immediately}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 2ad698e546..c2fff0a872 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@@ -420,7 +420,7 @@ async fn shell_missing_command_surfaces_127_with_dependency_hint() {#[cfg(not(windows))]#[tokio::test(flavor = "current_thread")]async fn shell_does_not_leak_api_key() {- let _g1 = EnvVarGuard::set("API_KEY", "sk-test-secret-12345");+ let _g1 = EnvVarGuard::locked_set("API_KEY", "sk-test-secret-12345");let tool = ShellTool::new(test_security_with_env_cmd(), test_runtime(), test_audit());let result = tooldiff --git a/crates/openhuman-core/src/voice/local_speech_tests.rs b/crates/openhuman-core/src/voice/local_speech_tests.rsindex 0099a62fd4..840b743c9f 100644--- a/crates/openhuman-core/src/voice/local_speech_tests.rs+++ b/crates/openhuman-core/src/voice/local_speech_tests.rs@@ -18,16 +18,12 @@ async fn synthesize_piper_rejects_empty_text() {async fn synthesize_piper_surfaces_binary_lookup_failure() {// Make sure a missing PIPER_BIN// produces an actionable error, not a panic in the spawn path.- let prev_piper = std::env::var_os("PIPER_BIN");- std::env::remove_var("PIPER_BIN");+ let _env = crate::config::test_env::EnvVarGuard::locked_unset("PIPER_BIN");let config = Config::default();let opts = PiperOptions::default();let result = synthesize_piper(&config, "hello world", &opts).await;- if let Some(v) = prev_piper {- std::env::set_var("PIPER_BIN", v);- }let err = result.err().expect("missing piper must error");assert!(diff --git a/crates/openhuman-core/src/voice/ops_tests.rs b/crates/openhuman-core/src/voice/ops_tests.rsindex 8e267865d2..6bfd14b27e 100644--- a/crates/openhuman-core/src/voice/ops_tests.rs+++ b/crates/openhuman-core/src/voice/ops_tests.rs@@ -62,7 +62,7 @@ async fn voice_status_detects_stub_binaries() {.expect("chmod");}- let _guard = EnvVarGuard::set("PIPER_BIN", &piper_stub.display().to_string());+ let _guard = EnvVarGuard::locked_set("PIPER_BIN", &piper_stub.display().to_string());let mut config = Config::default();config.workspace_dir = tmp.path().join("workspace");