Skip to content

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

refactor(test): replace raw env manipulation with EnvVarGuard in tests

Steven Enamakel8e4b1d285b4f
diff --git a/crates/openhuman-core/src/agent/session_import/live_tests.rs b/crates/openhuman-core/src/agent/session_import/live_tests.rs
index 2180fbd370..3a637fd6d7 100644
--- a/crates/openhuman-core/src/agent/session_import/live_tests.rs
+++ b/crates/openhuman-core/src/agent/session_import/live_tests.rs
@@ -13,9 +13,9 @@ use std::path::Path;
use tempfile::TempDir;
use tinyagents_harness::store::{AppendStore, JsonlAppendStore};
-use crate::config::test_env::EnvVarGuard;
use super::live::{dual_write_enabled, shadow_reads_enabled};
use super::projector::journal_message_from_transcript as project;
+use crate::config::test_env::EnvVarGuard;
use tinyagents_session::transcript::import::convert::journal_messages as journal_messages_with;
use tinyagents_session::transcript::import::live::{
shadow_read_compare as shadow_read_compare_with, write_live_turn as write_live_turn_with,
diff --git a/crates/openhuman-core/src/config/test_env.rs b/crates/openhuman-core/src/config/test_env.rs
index e55cb55d50..2a7b5470ce 100644
--- a/crates/openhuman-core/src/config/test_env.rs
+++ b/crates/openhuman-core/src/config/test_env.rs
@@ -74,7 +74,8 @@ impl EnvVarGuard {
/// Remove every key in `keys` (caller holds the env lock).
pub(crate) fn unset_many(keys: &[&'static str]) -> Self {
- keys.iter().fold(Self::new(), |guard, key| guard.without(key))
+ keys.iter()
+ .fold(Self::new(), |guard, key| guard.without(key))
}
/// Pin `OPENHUMAN_WORKSPACE` to `path` (caller holds the env lock).
diff --git a/crates/openhuman-core/src/config/workspace/ops_tests.rs b/crates/openhuman-core/src/config/workspace/ops_tests.rs
index dac1456c9e..d6cf6fe283 100644
--- a/crates/openhuman-core/src/config/workspace/ops_tests.rs
+++ b/crates/openhuman-core/src/config/workspace/ops_tests.rs
@@ -1,7 +1,7 @@
use super::*;
+use crate::config::test_env::EnvVarGuard;
use crate::config::TEST_ENV_LOCK as ENV_LOCK;
use tempfile::tempdir;
-use crate::config::test_env::EnvVarGuard;
// ── ensure_workspace_file ──────────────────────────────────────
diff --git a/crates/openhuman-core/src/core/cli_tests.rs b/crates/openhuman-core/src/core/cli_tests.rs
index b8d352191e..58e2b8f8a1 100644
--- a/crates/openhuman-core/src/core/cli_tests.rs
+++ b/crates/openhuman-core/src/core/cli_tests.rs
@@ -2,6 +2,7 @@ use super::{
grouped_schemas, load_dotenv_for_cli, parse_function_params, parse_input_value,
parse_launch_options,
};
+use crate::config::test_env::EnvVarGuard;
use crate::core::{ControllerSchema, FieldSchema, TypeSchema};
use tempfile::tempdir;
@@ -52,11 +53,19 @@ fn launch_options_reject_missing_or_empty_values() {
}
}
-/// Serialises env-mutating CLI tests via the crate-wide backend env lock —
-/// these tests set `BACKEND_URL`, which `openhuman_tinyhumans::backend::url`
-/// tests also read/remove, so a module-local lock is not enough.
-fn env_lock() -> std::sync::MutexGuard<'static, ()> {
- crate::config::app_env::env_test_lock()
+/// Serialises env-mutating CLI tests on the crate-wide env lock and the
+/// backend env lock — these tests set `BACKEND_URL`, which
+/// `openhuman_tinyhumans::backend::url` tests also read/remove, and other
+/// suites mutate env under `TEST_ENV_LOCK` alone, so neither lock suffices on
+/// its own. Taken in the established order: `TEST_ENV_LOCK`, then backend.
+fn env_lock() -> (
+ std::sync::MutexGuard<'static, ()>,
+ std::sync::MutexGuard<'static, ()>,
+) {
+ (
+ crate::config::test_env::lock_env(),
+ crate::config::app_env::env_test_lock(),
+ )
}
#[test]
@@ -166,15 +175,10 @@ fn load_dotenv_for_cli_reads_cwd_dotenv_without_overwriting_existing_env() {
.expect("write .env");
let original_dir = std::env::current_dir().expect("current dir");
- let prior_backend = std::env::var("BACKEND_URL").ok();
- let prior_app_env = std::env::var("OPENHUMAN_APP_ENV").ok();
- let prior_dotenv_path = std::env::var("OPENHUMAN_DOTENV_PATH").ok();
-
- unsafe {
- std::env::remove_var("BACKEND_URL");
- std::env::set_var("OPENHUMAN_APP_ENV", "production");
- std::env::remove_var("OPENHUMAN_DOTENV_PATH");
- }
+ // Env lock is held by `_guard`; the vars are restored when `_vars` drops.
+ let _vars = EnvVarGuard::unset("BACKEND_URL")
+ .with("OPENHUMAN_APP_ENV", "production")
+ .without("OPENHUMAN_DOTENV_PATH");
std::env::set_current_dir(tmp.path()).expect("set current dir");
let result = load_dotenv_for_cli();
@@ -183,20 +187,6 @@ fn load_dotenv_for_cli_reads_cwd_dotenv_without_overwriting_existing_env() {
let loaded_app_env = std::env::var("OPENHUMAN_APP_ENV").ok();
std::env::set_current_dir(&original_dir).expect("restore current dir");
- unsafe {
- match prior_backend {
- Some(value) => std::env::set_var("BACKEND_URL", value),
- None => std::env::remove_var("BACKEND_URL"),
- }
- match prior_app_env {
- Some(value) => std::env::set_var("OPENHUMAN_APP_ENV", value),
- None => std::env::remove_var("OPENHUMAN_APP_ENV"),
- }
- match prior_dotenv_path {
- Some(value) => std::env::set_var("OPENHUMAN_DOTENV_PATH", value),
- None => std::env::remove_var("OPENHUMAN_DOTENV_PATH"),
- }
- }
result.expect("dotenv load should succeed");
assert_eq!(
@@ -404,14 +394,9 @@ fn default_build_leaves_the_generic_namespace_path_unchanged() {
/// the family. Assert through the entry point or this regresses silently.
#[test]
fn generic_namespace_path_reports_the_config_fact_under_a_driver_without_the_family() {
- let _env_lock = crate::config::TEST_ENV_LOCK
- .lock()
- .unwrap_or_else(|poisoned| poisoned.into_inner());
let workspace = tempdir().expect("temp workspace");
-
- // SAFETY: serialised by TEST_ENV_LOCK, and both vars are restored below.
- std::env::set_var("OPENHUMAN_WORKSPACE", workspace.path());
- std::env::set_var("OPENHUMAN_MEMORY_DRIVER", "null");
+ // Env lock held, and both vars restored, until the guard drops.
+ let _env = EnvVarGuard::workspace(workspace.path()).with("OPENHUMAN_MEMORY_DRIVER", "null");
let err = super::run_namespace_command(
"memory_tree",
@@ -420,9 +405,6 @@ fn generic_namespace_path_reports_the_config_fact_under_a_driver_without_the_fam
)
.expect_err("`tree` is not advertised by the null driver, so this must not run");
- std::env::remove_var("OPENHUMAN_MEMORY_DRIVER");
- std::env::remove_var("OPENHUMAN_WORKSPACE");
-
let message = err.to_string();
assert!(
message.starts_with(crate::core::cli_capability::CAPABILITY_UNAVAILABLE_PREFIX),
@@ -440,14 +422,9 @@ fn generic_namespace_path_reports_the_config_fact_under_a_driver_without_the_fam
#[test]
fn raw_call_path_rejects_a_method_the_bound_driver_does_not_advertise() {
- let _env_lock = crate::config::TEST_ENV_LOCK
- .lock()
- .unwrap_or_else(|poisoned| poisoned.into_inner());
let workspace = tempdir().expect("temp workspace");
-
- // SAFETY: serialised by TEST_ENV_LOCK, and both vars are restored below.
- std::env::set_var("OPENHUMAN_WORKSPACE", workspace.path());
- std::env::set_var("OPENHUMAN_MEMORY_DRIVER", "null");
+ // Env lock held, and both vars restored, until the guard drops.
+ let _env = EnvVarGuard::workspace(workspace.path()).with("OPENHUMAN_MEMORY_DRIVER", "null");
let err = super::run_call_command(&[
"--method".to_string(),
@@ -455,9 +432,6 @@ fn raw_call_path_rejects_a_method_the_bound_driver_does_not_advertise() {
])
.expect_err("the null driver must not dispatch a tree wipe");
- std::env::remove_var("OPENHUMAN_MEMORY_DRIVER");
- std::env::remove_var("OPENHUMAN_WORKSPACE");
-
let message = err.to_string();
assert!(
message.starts_with(crate::core::cli_capability::CAPABILITY_UNAVAILABLE_PREFIX),
diff --git a/crates/openhuman-core/src/core/dispatch_tests.rs b/crates/openhuman-core/src/core/dispatch_tests.rs
index 8120cd2d6f..91c95bd461 100644
--- a/crates/openhuman-core/src/core/dispatch_tests.rs
+++ b/crates/openhuman-core/src/core/dispatch_tests.rs
@@ -1,7 +1,7 @@
use super::*;
+use crate::config::test_env::EnvVarGuard;
use serde_json::json;
use std::ffi::OsString;
-use crate::config::test_env::EnvVarGuard;
fn test_state() -> AppState {
AppState {
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 7f9f99864a..181c79ef07 100644
--- a/crates/openhuman-core/src/integrations/composio/action_tool_tests.rs
+++ b/crates/openhuman-core/src/integrations/composio/action_tool_tests.rs
@@ -1,7 +1,7 @@
use super::*;
use crate::agent::harness::with_current_sandbox_mode;
-use std::path::Path;
use crate::config::test_env::EnvVarGuard;
+use std::path::Path;
/// Build a minimal `Arc<Config>` with `composio.mode = "backend"`
/// (the default). The sandbox gate runs *before* any HTTP call or
diff --git a/crates/openhuman-core/src/integrations/composio/ops_tests.rs b/crates/openhuman-core/src/integrations/composio/ops_tests.rs
index 0223caed61..6e6474f264 100644
--- a/crates/openhuman-core/src/integrations/composio/ops_tests.rs
+++ b/crates/openhuman-core/src/integrations/composio/ops_tests.rs
@@ -23,6 +23,7 @@ fn cache_guard() -> std::sync::MutexGuard<'static, ()> {
// ── Mock-backend integration tests for ops ─────────────────────
+use crate::config::test_env::EnvVarGuard;
use axum::{
extract::{Path, Query, State},
http::HeaderMap,
@@ -33,7 +34,6 @@ use chrono::{TimeZone, Utc};
use serde_json::{json, Value};
use std::collections::HashMap;
use tinymemory_api::chunks::{chunk_id, Chunk, Metadata, SourceKind, SourceRef};
-use crate::config::test_env::EnvVarGuard;
struct DirectAuthFailureGuard {
key_id: u64,
diff --git a/crates/openhuman-core/src/integrations/composio/tools_tests.rs b/crates/openhuman-core/src/integrations/composio/tools_tests.rs
index 8db43bb44a..0be7324b43 100644
--- a/crates/openhuman-core/src/integrations/composio/tools_tests.rs
+++ b/crates/openhuman-core/src/integrations/composio/tools_tests.rs
@@ -2,8 +2,8 @@ use super::*;
use std::path::Path;
use std::sync::Arc;
-use tinytools::ToolResult;
use crate::config::test_env::EnvVarGuard;
+use tinytools::ToolResult;
/// Minimal `Arc<Config>` for the agent-tool constructors. All five
/// composio agent tools now resolve their client per call through
diff --git a/crates/openhuman-core/src/memory/ops/files_tests.rs b/crates/openhuman-core/src/memory/ops/files_tests.rs
index 7c09fb0d72..d98d6d1c27 100644
--- a/crates/openhuman-core/src/memory/ops/files_tests.rs
+++ b/crates/openhuman-core/src/memory/ops/files_tests.rs
@@ -3,8 +3,8 @@ use std::ffi::OsString;
use tempfile::TempDir;
use super::*;
-use crate::config::TEST_ENV_LOCK;
use crate::config::test_env::EnvVarGuard;
+use crate::config::TEST_ENV_LOCK;
#[tokio::test]
async fn write_read_and_list_memory_files_roundtrip() {
diff --git a/crates/openhuman-core/src/memory/ops/learn_tests.rs b/crates/openhuman-core/src/memory/ops/learn_tests.rs
index 316d65adf3..1754bc7102 100644
--- a/crates/openhuman-core/src/memory/ops/learn_tests.rs
+++ b/crates/openhuman-core/src/memory/ops/learn_tests.rs
@@ -3,8 +3,8 @@ use std::ffi::OsString;
use serde_json::json;
use super::*;
-use crate::memory::api::types::NamespaceDocumentInput;
use crate::config::test_env::EnvVarGuard;
+use crate::memory::api::types::NamespaceDocumentInput;
fn ensure_memory_client() {
crate::memory::ops::shared_memory_test_workspace();
diff --git a/crates/openhuman-core/src/memory/query/ingest_document_tests.rs b/crates/openhuman-core/src/memory/query/ingest_document_tests.rs
index a04a0421ed..60f82af2d9 100644
--- a/crates/openhuman-core/src/memory/query/ingest_document_tests.rs
+++ b/crates/openhuman-core/src/memory/query/ingest_document_tests.rs
@@ -3,11 +3,11 @@ use std::ffi::OsString;
use tempfile::TempDir;
+use crate::config::test_env::EnvVarGuard;
use crate::config::Config;
use crate::config::TEST_ENV_LOCK;
use serde_json::json;
use tinytools::Tool;
-use crate::config::test_env::EnvVarGuard;
async fn isolated_config(tmp: &TempDir) -> (EnvVarGuard, Config) {
let guard = EnvVarGuard::workspace(tmp.path());
diff --git a/crates/openhuman-core/src/memory/sources/rpc_tests.rs b/crates/openhuman-core/src/memory/sources/rpc_tests.rs
index e33727de6e..2f752ee787 100644
--- a/crates/openhuman-core/src/memory/sources/rpc_tests.rs
+++ b/crates/openhuman-core/src/memory/sources/rpc_tests.rs
@@ -19,10 +19,10 @@ use crate::memory::sources::types::MemorySourceEntry;
// Needed to call the family accessors on the *concrete* null provider
// below; the handlers above reach them through `dyn MemoryProvider`, where
// the trait is in scope by construction.
+use crate::config::test_env::EnvVarGuard;
use crate::memory::api::provider::MemoryProvider;
use std::sync::Arc;
use tinymemory_api::null::{NullMemoryProvider, NULL_DRIVER_ID};
-use crate::config::test_env::EnvVarGuard;
/// The refusal always names the bound driver. That is the whole contract of
/// this message: an operator reading it has to be able to tell "no driver
diff --git a/crates/openhuman-core/src/memory/tools/goals_tests.rs b/crates/openhuman-core/src/memory/tools/goals_tests.rs
index a640b1377f..3f781c2f3f 100644
--- a/crates/openhuman-core/src/memory/tools/goals_tests.rs
+++ b/crates/openhuman-core/src/memory/tools/goals_tests.rs
@@ -15,9 +15,9 @@ use std::ffi::OsString;
use tempfile::TempDir;
+use crate::config::test_env::EnvVarGuard;
use crate::config::TEST_ENV_LOCK;
use tinytools::Tool;
-use crate::config::test_env::EnvVarGuard;
/// Reset the shared goals document, and say why that has to happen at all.
///
diff --git a/crates/openhuman-core/src/memory/tools/tool_memory/guard_tests.rs b/crates/openhuman-core/src/memory/tools/tool_memory/guard_tests.rs
index 2a53bf7d41..b6e440a4ef 100644
--- a/crates/openhuman-core/src/memory/tools/tool_memory/guard_tests.rs
+++ b/crates/openhuman-core/src/memory/tools/tool_memory/guard_tests.rs
@@ -12,6 +12,7 @@ use crate::memory::api::tool_memory::{ToolMemoryPriority, ToolMemorySource};
use tempfile::TempDir;
+use crate::config::test_env::EnvVarGuard;
use crate::config::Config;
use crate::config::TEST_ENV_LOCK;
use crate::memory::guard::policy::GUARD_DENIED_PREFIX;
@@ -20,7 +21,6 @@ use crate::security::policy::{AutonomyLevel, SecurityPolicy};
use serde_json::json;
use std::sync::Arc;
use tinytools::Tool;
-use crate::config::test_env::EnvVarGuard;
/// Install `autonomy` as the live policy for this test thread only. Same
/// shape `memory/guard/policy_tests.rs` uses; `#[tokio::test]`'s
diff --git a/crates/openhuman-core/src/platform/update/ops_tests_2_tests.rs b/crates/openhuman-core/src/platform/update/ops_tests_2_tests.rs
index d2e813cefe..4db2302462 100644
--- a/crates/openhuman-core/src/platform/update/ops_tests_2_tests.rs
+++ b/crates/openhuman-core/src/platform/update/ops_tests_2_tests.rs
@@ -1,7 +1,7 @@
use super::*;
+use crate::config::test_env::EnvVarGuard;
use crate::config::TEST_ENV_LOCK;
use tempfile::TempDir;
-use crate::config::test_env::EnvVarGuard;
async fn write_update_policy(tmp: &TempDir, update: UpdateConfig) {
let mut cfg = crate::config::Config {
diff --git a/crates/openhuman-core/src/security/approval/gate_tests.rs b/crates/openhuman-core/src/security/approval/gate_tests.rs
index c71ac6cf5a..7e4b06660c 100644
--- a/crates/openhuman-core/src/security/approval/gate_tests.rs
+++ b/crates/openhuman-core/src/security/approval/gate_tests.rs
@@ -1,6 +1,6 @@
use super::*;
-use tempfile::TempDir;
use crate::config::test_env::EnvVarGuard;
+use tempfile::TempDir;
/// TTL for the tests that assert the *timeout* path — the only ones that
/// need a park to expire while the test is still running.
diff --git a/crates/openhuman-core/src/security/credentials/openai_oauth/flow_tests.rs b/crates/openhuman-core/src/security/credentials/openai_oauth/flow_tests.rs
index 346a2b0bc3..37d2d7f9e6 100644
--- a/crates/openhuman-core/src/security/credentials/openai_oauth/flow_tests.rs
+++ b/crates/openhuman-core/src/security/credentials/openai_oauth/flow_tests.rs
@@ -2,6 +2,7 @@ use super::store::persist_openai_oauth_token;
use super::{
complete_openai_oauth, disconnect_openai_oauth, openai_oauth_status, start_openai_oauth,
};
+use crate::config::test_env::EnvVarGuard;
use crate::config::Config;
use crate::inference::provider::factory::lookup_key_for_slug;
use crate::security::credentials::openai_oauth::store::{
@@ -21,7 +22,6 @@ use tinyinference_providers::oauth::{
};
use wiremock::matchers::{method, path};
use wiremock::{Mock, MockServer, ResponseTemplate};
-use crate::config::test_env::EnvVarGuard;
fn tiny_oauth_config(config: &OAuthConfig, redirect_uri: &str) -> OAuthConfig {
let mut config = config.clone();
diff --git a/crates/openhuman-core/src/security/credentials/ops/boot_env_tests.rs b/crates/openhuman-core/src/security/credentials/ops/boot_env_tests.rs
index 04bbfb2b59..623fbf1a84 100644
--- a/crates/openhuman-core/src/security/credentials/ops/boot_env_tests.rs
+++ b/crates/openhuman-core/src/security/credentials/ops/boot_env_tests.rs
@@ -1,7 +1,7 @@
use super::*;
+use crate::config::test_env::EnvVarGuard;
use crate::config::Config;
use tempfile::TempDir;
-use crate::config::test_env::EnvVarGuard;
fn config_in(tmp: &TempDir) -> Config {
Config {
diff --git a/crates/openhuman-core/src/security/credentials/ops_tests.rs b/crates/openhuman-core/src/security/credentials/ops_tests.rs
index 5631aa9a06..82e6f95cc4 100644
--- a/crates/openhuman-core/src/security/credentials/ops_tests.rs
+++ b/crates/openhuman-core/src/security/credentials/ops_tests.rs
@@ -1,4 +1,5 @@
use super::*;
+use crate::config::test_env::EnvVarGuard;
use crate::config::{default_root_openhuman_dir, user_openhuman_dir, write_active_user_id, Config};
use crate::security::credentials::session_support::local_session_user_id;
use crate::security::credentials::{
@@ -12,7 +13,6 @@ use base64::Engine;
use serde_json::json;
use tempfile::TempDir;
use tokio::net::TcpListener;
-use crate::config::test_env::EnvVarGuard;
fn test_config(tmp: &TempDir) -> Config {
let config = Config {
diff --git a/crates/openhuman-core/src/security/keyring/store_tests.rs b/crates/openhuman-core/src/security/keyring/store_tests.rs
index 5c818cf69c..25a512bbb3 100644
--- a/crates/openhuman-core/src/security/keyring/store_tests.rs
+++ b/crates/openhuman-core/src/security/keyring/store_tests.rs
@@ -19,9 +19,9 @@ use std::path::PathBuf;
use super::test_scope::ScopedWorkspace;
use super::{resolve_workspace_dir, workspace_dir_for_file_backend};
+use crate::config::test_env::EnvVarGuard;
use crate::config::TEST_ENV_LOCK;
use crate::security::keyring;
-use crate::config::test_env::EnvVarGuard;
/// The root-cause pin: in test builds the keyring workspace must not be
/// steerable by a process-wide env var, because any test can set it while
diff --git a/crates/openhuman-core/src/threads/ops_tests.rs b/crates/openhuman-core/src/threads/ops_tests.rs
index 87d3ad880f..d4810f128d 100644
--- a/crates/openhuman-core/src/threads/ops_tests.rs
+++ b/crates/openhuman-core/src/threads/ops_tests.rs
@@ -5,6 +5,7 @@
use super::*;
// Re-imported here rather than through `ops`: `ops` itself no longer names
// these, so importing them there would be an unused import in a non-test build.
+use crate::config::test_env::EnvVarGuard;
use crate::memory::conversations as conversations_store;
use crate::threads::turn_state::{ClearTurnStateRequest, GetTurnStateRequest};
use crate::threads::ThreadsError;
@@ -13,7 +14,6 @@ use std::ffi::OsString;
use std::path::Path;
use tinyagents_harness::title::{build_title_prompt, THREAD_TITLE_SYSTEM_PROMPT};
use tinyagents_session::turn_state::TurnState;
-use crate::config::test_env::EnvVarGuard;
// ── thread_to_summary / message_to_record / record_to_message ─
diff --git a/crates/openhuman-core/src/threads/schemas_tests.rs b/crates/openhuman-core/src/threads/schemas_tests.rs
index e7813f4554..a8e08511ae 100644
--- a/crates/openhuman-core/src/threads/schemas_tests.rs
+++ b/crates/openhuman-core/src/threads/schemas_tests.rs
@@ -1,6 +1,6 @@
use super::*;
-use serde_json::json;
use crate::config::test_env::EnvVarGuard;
+use serde_json::json;
const ALL_FUNCTIONS: &[&str] = &[
"list",
diff --git a/crates/openhuman-core/src/tools/impl/system/shell_tests.rs b/crates/openhuman-core/src/tools/impl/system/shell_tests.rs
index b78b788f1e..930151644a 100644
--- a/crates/openhuman-core/src/tools/impl/system/shell_tests.rs
+++ b/crates/openhuman-core/src/tools/impl/system/shell_tests.rs
@@ -1,7 +1,7 @@
use super::*;
use crate::agent::host_runtime::{NativeRuntime, RuntimeAdapter};
-use crate::security::{AutonomyLevel, CommandClass, SecurityPolicy};
use crate::config::test_env::EnvVarGuard;
+use crate::security::{AutonomyLevel, CommandClass, SecurityPolicy};
fn test_security(autonomy: AutonomyLevel) -> Arc<SecurityPolicy> {
Arc::new(SecurityPolicy {
diff --git a/crates/openhuman-core/src/tools/registry/ops_tests.rs b/crates/openhuman-core/src/tools/registry/ops_tests.rs
index 0d0daf5051..ecc9d15dc9 100644
--- a/crates/openhuman-core/src/tools/registry/ops_tests.rs
+++ b/crates/openhuman-core/src/tools/registry/ops_tests.rs
@@ -1,7 +1,7 @@
use super::*;
use crate::config::schema::{CapabilityProviderConfig, CapabilityProviderTrustState, Config};
-use crate::core::{FieldSchema, TypeSchema};
use crate::config::test_env::EnvVarGuard;
+use crate::core::{FieldSchema, TypeSchema};
#[test]
fn registry_entries_include_mcp_and_controller_tools() {
diff --git a/crates/openhuman-core/src/web3/wallet/test_support.rs b/crates/openhuman-core/src/web3/wallet/test_support.rs
index b125bb813b..dfeb889edd 100644
--- a/crates/openhuman-core/src/web3/wallet/test_support.rs
+++ b/crates/openhuman-core/src/web3/wallet/test_support.rs
@@ -17,8 +17,8 @@ use tempfile::TempDir;
use super::ops::{setup, WalletAccount, WalletChain, WalletSetupParams, WalletSetupSource};
use crate::config::rpc as config_rpc;
-use crate::config::TEST_ENV_LOCK;
use crate::config::test_env::EnvVarGuard;
+use crate::config::TEST_ENV_LOCK;
pub(crate) static TEST_LOCK: Lazy<Mutex<()>> = Lazy::new(|| Mutex::new(()));
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 846b17fc20..6fe82fbc48 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,7 +300,8 @@ 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.
- let _env_guard = crate::config::test_env::EnvVarGuard::locked_set("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;