Skip to content

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

test(composio): remove unused test files

Steven Enamakel1993ca59ab0f
diff --git a/crates/openhuman-core/src/integrations/composio/action_tool_tests.rs b/crates/openhuman-core/src/integrations/composio/action_tool_tests.rs
index 9435491c55..7f9f99864a 100644
--- a/crates/openhuman-core/src/integrations/composio/action_tool_tests.rs
+++ b/crates/openhuman-core/src/integrations/composio/action_tool_tests.rs
@@ -394,7 +394,7 @@ fn mode_toggle_between_calls_is_observed() {
// ── Direct half ─────────────────────────────────────────────
let tmp_direct = tempfile::tempdir().expect("tempdir direct");
- EnvVarGuard::set_current(tmp_direct.path());
+ std::env::set_var("OPENHUMAN_WORKSPACE", tmp_direct.path());
let mut direct_config = Config::default();
direct_config.config_path = tmp_direct.path().join("config.toml");
direct_config.workspace_dir = tmp_direct.path().join("workspace");
diff --git a/crates/openhuman-core/src/integrations/composio/ops_profile_tools_execute_mock_tests.rs b/crates/openhuman-core/src/integrations/composio/ops_profile_tools_execute_mock_tests.rs
index ef25fa582c..e309a878d0 100644
--- a/crates/openhuman-core/src/integrations/composio/ops_profile_tools_execute_mock_tests.rs
+++ b/crates/openhuman-core/src/integrations/composio/ops_profile_tools_execute_mock_tests.rs
@@ -61,7 +61,7 @@ async fn composio_get_user_profile_via_mock_returns_provider_profile() {
let _backend_url_guard = EnvVarGuard::set("BACKEND_URL", &base);
let tmp = tempfile::tempdir().unwrap();
let config = config_with_backend(&tmp, base);
- let _workspace_env_guard = WorkspaceEnvGuard::set(tmp.path());
+ let _workspace_env_guard = EnvVarGuard::workspace_unlocked(tmp.path());
config.save().await.unwrap();
let outcome = composio_get_user_profile(&config, "c1").await.unwrap();
diff --git a/crates/openhuman-core/src/integrations/composio/tools_direct_mode_routing_tests.rs b/crates/openhuman-core/src/integrations/composio/tools_direct_mode_routing_tests.rs
index 6b34f755df..56942c6d1f 100644
--- a/crates/openhuman-core/src/integrations/composio/tools_direct_mode_routing_tests.rs
+++ b/crates/openhuman-core/src/integrations/composio/tools_direct_mode_routing_tests.rs
@@ -86,8 +86,8 @@ async fn list_tools_in_direct_mode_returns_empty_without_hitting_backend() {
let _env_guard = TEST_ENV_LOCK.lock().unwrap_or_else(|e| e.into_inner());
let tmp = tempfile::tempdir().expect("tempdir");
- let _workspace_guard = WorkspaceEnvGuard::set(tmp.path());
- let _home_guard = HomeEnvGuard::set(tmp.path());
+ let _workspace_guard = EnvVarGuard::workspace_unlocked(tmp.path());
+ let _home_guard = EnvVarGuard::set("HOME", tmp.path());
let mut config = crate::config::Config::default();
config.config_path = tmp.path().join("config.toml");
@@ -143,8 +143,8 @@ async fn execute_tool_per_call_factory_means_no_baked_client() {
let _env_guard = TEST_ENV_LOCK.lock().unwrap_or_else(|e| e.into_inner());
let tmp = tempfile::tempdir().unwrap();
- let _workspace_guard = WorkspaceEnvGuard::set(tmp.path());
- let _home_guard = HomeEnvGuard::set(tmp.path());
+ let _workspace_guard = EnvVarGuard::workspace_unlocked(tmp.path());
+ let _home_guard = EnvVarGuard::set("HOME", tmp.path());
let mut config = crate::config::Config::default();
config.config_path = tmp.path().join("config.toml");
@@ -191,8 +191,8 @@ async fn list_toolkits_in_direct_mode_returns_empty_without_hitting_backend() {
let _env_guard = TEST_ENV_LOCK.lock().unwrap_or_else(|e| e.into_inner());
let tmp = tempfile::tempdir().expect("tempdir");
- let _workspace_guard = WorkspaceEnvGuard::set(tmp.path());
- let _home_guard = HomeEnvGuard::set(tmp.path());
+ let _workspace_guard = EnvVarGuard::workspace_unlocked(tmp.path());
+ let _home_guard = EnvVarGuard::set("HOME", tmp.path());
let mut config = crate::config::Config::default();
config.config_path = tmp.path().join("config.toml");
@@ -264,8 +264,8 @@ async fn authorize_in_direct_mode_refuses_with_app_composio_dev_hint() {
let _env_guard = TEST_ENV_LOCK.lock().unwrap_or_else(|e| e.into_inner());
let tmp = tempfile::tempdir().expect("tempdir");
- let _workspace_guard = WorkspaceEnvGuard::set(tmp.path());
- let _home_guard = HomeEnvGuard::set(tmp.path());
+ let _workspace_guard = EnvVarGuard::workspace_unlocked(tmp.path());
+ let _home_guard = EnvVarGuard::set("HOME", tmp.path());
let mut config = crate::config::Config::default();
config.config_path = tmp.path().join("config.toml");
diff --git a/crates/openhuman-core/src/integrations/composio/tools_metadata_and_sandbox_tests.rs b/crates/openhuman-core/src/integrations/composio/tools_metadata_and_sandbox_tests.rs
index 52bb96ffa1..3ef11b605c 100644
--- a/crates/openhuman-core/src/integrations/composio/tools_metadata_and_sandbox_tests.rs
+++ b/crates/openhuman-core/src/integrations/composio/tools_metadata_and_sandbox_tests.rs
@@ -399,7 +399,7 @@ async fn sandbox_read_only_passes_through_read_scope_actions_to_downstream_gates
let _env_guard = TEST_ENV_LOCK.lock().unwrap_or_else(|e| e.into_inner());
let tmp = tempfile::tempdir().expect("tempdir");
- let _workspace_guard = WorkspaceEnvGuard::set(tmp.path());
+ let _workspace_guard = EnvVarGuard::workspace_unlocked(tmp.path());
let mut config = crate::config::Config::default();
config.config_path = tmp.path().join("config.toml");
@@ -435,7 +435,7 @@ async fn sandbox_unset_leaves_all_scopes_to_downstream_gates() {
let _env_guard = TEST_ENV_LOCK.lock().unwrap_or_else(|e| e.into_inner());
let tmp = tempfile::tempdir().expect("tempdir");
- let _workspace_guard = WorkspaceEnvGuard::set(tmp.path());
+ let _workspace_guard = EnvVarGuard::workspace_unlocked(tmp.path());
let mut config = crate::config::Config::default();
config.config_path = tmp.path().join("config.toml");
@@ -470,7 +470,7 @@ async fn sandbox_sandboxed_mode_does_not_trigger_readonly_gate() {
let _env_guard = TEST_ENV_LOCK.lock().unwrap_or_else(|e| e.into_inner());
let tmp = tempfile::tempdir().expect("tempdir");
- let _workspace_guard = WorkspaceEnvGuard::set(tmp.path());
+ let _workspace_guard = EnvVarGuard::workspace_unlocked(tmp.path());
let mut config = crate::config::Config::default();
config.config_path = tmp.path().join("config.toml");
diff --git a/crates/openhuman-core/src/security/approval/gate_tests.rs b/crates/openhuman-core/src/security/approval/gate_tests.rs
index 413a42b12a..f1070e24ff 100644
--- a/crates/openhuman-core/src/security/approval/gate_tests.rs
+++ b/crates/openhuman-core/src/security/approval/gate_tests.rs
@@ -77,39 +77,14 @@ fn parked_request_id(gate: &ApprovalGate) -> Option<String> {
/// these tests unnecessarily.
/// `test_gate_with_ttl` must not take the lock, because the
/// `effective_ttl_*` tests call it while already holding it.
-struct ExpiryEnvGuard {
- previous_ttl: Option<String>,
- _env_lock: std::sync::MutexGuard<'static, ()>,
-}
-
-impl Drop for ExpiryEnvGuard {
- fn drop(&mut self) {
- match self.previous_ttl.take() {
- Some(value) => unsafe { std::env::set_var("OPENHUMAN_APPROVAL_TTL_SECS", value) },
- None => unsafe { std::env::remove_var("OPENHUMAN_APPROVAL_TTL_SECS") },
- }
- }
-}
-
-fn expiry_gate() -> (ApprovalGate, TempDir, ExpiryEnvGuard) {
- let env = crate::config::TEST_ENV_LOCK
- .lock()
- .unwrap_or_else(|e| e.into_inner());
+fn expiry_gate() -> (ApprovalGate, TempDir, EnvVarGuard) {
// The lock keeps a sibling test from setting the override, but not a
// developer who exported it in their shell. effective_ttl would then
// replace EXPIRY_TEST_TTL at park time and the wait would be measuring
// their value, so clear it while the lock is held.
- let previous_ttl = std::env::var("OPENHUMAN_APPROVAL_TTL_SECS").ok();
- unsafe { std::env::remove_var("OPENHUMAN_APPROVAL_TTL_SECS") };
+ let env = EnvVarGuard::locked_unset("OPENHUMAN_APPROVAL_TTL_SECS");
let (gate, dir) = test_gate_with_ttl(EXPIRY_TEST_TTL);
- (
- gate,
- dir,
- ExpiryEnvGuard {
- previous_ttl,
- _env_lock: env,
- },
- )
+ (gate, dir, env)
}
/// Decide a row that the test has just seen parked, failing on the expiry
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.rs
index f72e8e4ca2..2ad698e546 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 = EnvGuard::set("API_KEY", "sk-test-secret-12345");
+ let _g1 = EnvVarGuard::set("API_KEY", "sk-test-secret-12345");
let tool = ShellTool::new(test_security_with_env_cmd(), test_runtime(), test_audit());
let result = tool
diff --git a/crates/openhuman-core/src/web_chat/web_tests_session_and_concurrency_tests.rs b/crates/openhuman-core/src/web_chat/web_tests_session_and_concurrency_tests.rs
index e424a6dcc1..846b17fc20 100644
--- a/crates/openhuman-core/src/web_chat/web_tests_session_and_concurrency_tests.rs
+++ b/crates/openhuman-core/src/web_chat/web_tests_session_and_concurrency_tests.rs
@@ -300,16 +300,7 @@ async fn wedged_turn_hits_wall_clock_backstop_and_emits_turn_timeout_chat_error(
// Panic-safe teardown of the process-global env override: if any assertion
// below unwinds, this guard still clears `OPENHUMAN_WEB_TURN_TIMEOUT_SECS` so
// a 1s backstop can't leak into unrelated tests sharing this process.
- struct EnvGuard;
- impl Drop for EnvGuard {
- fn drop(&mut self) {
- std::env::remove_var("OPENHUMAN_WEB_TURN_TIMEOUT_SECS");
- }
- }
- let _env_guard = EnvGuard;
- // Tight 1s backstop so the parked (30s) turn trips it quickly. Scoped to this
- // serialized test and cleared by `EnvGuard` on drop (even on unwind).
- std::env::set_var("OPENHUMAN_WEB_TURN_TIMEOUT_SECS", "1");
+ let _env_guard = crate::config::test_env::EnvVarGuard::locked_set("OPENHUMAN_WEB_TURN_TIMEOUT_SECS", "1");
let block = make_block();
set_test_run_chat_task_block(Some(block.clone())).await;