Skip to content

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

test(threads): pin persistent storage in workspace-scoped tests

Steven Enamakela7edbc2317fe
diff --git a/crates/openhuman-core/src/security/credentials/ops/user_scope_tests.rs b/crates/openhuman-core/src/security/credentials/ops/user_scope_tests.rs
index 4f7bb2df72..5567ceac21 100644
--- a/crates/openhuman-core/src/security/credentials/ops/user_scope_tests.rs
+++ b/crates/openhuman-core/src/security/credentials/ops/user_scope_tests.rs
@@ -27,6 +27,7 @@ fn first_user_activation_queues_prelogin_purge_in_the_removed_workspace() {
let _env = env.with("OPENHUMAN_WORKSPACE", &root);
let prelogin_workspace = crate::config::pre_login_user_dir(&root).join("workspace");
let active_workspace = crate::config::user_openhuman_dir(&root, "new-user").join("workspace");
+ crate::storage::local::use_persistent_default_for_test(&prelogin_workspace);
let ctx = crate::core::runtime::DispatchCtx::unbound();
assert!(operator_user_activation_allowed());
assert!(crate::config::read_active_user_id(&root).is_none());
diff --git a/crates/openhuman-core/src/threads/ops_conversion_tests.rs b/crates/openhuman-core/src/threads/ops_conversion_tests.rs
index 1cbf939dd8..0eed57ef6f 100644
--- a/crates/openhuman-core/src/threads/ops_conversion_tests.rs
+++ b/crates/openhuman-core/src/threads/ops_conversion_tests.rs
@@ -429,6 +429,7 @@ async fn generate_title_falls_back_to_first_user_message_when_assistant_missing(
async fn thread_delete_removes_persisted_turn_state_snapshot() {
let _env_lock = crate::config::TEST_ENV_LOCK.lock().await;
let workspace = tempfile::tempdir().expect("workspace");
+ crate::storage::local::use_persistent_default_for_test(workspace.path());
let _workspace_guard = EnvVarGuard::set("OPENHUMAN_WORKSPACE", workspace.path());
let thread_id = "thread-delete";
create_thread_with_title(&workspace, thread_id, "Chat Jan 1 1:00 AM").await;
@@ -493,6 +494,7 @@ async fn thread_delete_queues_memory_before_snapshot_cleanup_error() {
let workspace = tempfile::tempdir().expect("workspace");
let dir = workspace.path().to_path_buf();
+ crate::storage::local::use_persistent_default_for_test(&dir);
let thread_id = "channel:discord/sender/chat";
let mut config = crate::config::Config {
workspace_dir: dir.clone(),
@@ -588,6 +590,7 @@ async fn thread_delete_queues_memory_before_snapshot_cleanup_error() {
async fn threads_purge_removes_every_turn_state_snapshot() {
let _env_lock = crate::config::TEST_ENV_LOCK.lock().await;
let workspace = tempfile::tempdir().expect("workspace");
+ crate::storage::local::use_persistent_default_for_test(workspace.path());
let _workspace_guard = EnvVarGuard::set("OPENHUMAN_WORKSPACE", workspace.path());
create_thread_with_title(&workspace, "thread-a", "Chat Jan 1 1:00 AM").await;
create_thread_with_title(&workspace, "thread-b", "Chat Jan 1 1:01 AM").await;
@@ -693,6 +696,7 @@ async fn thread_update_title_rejects_empty_and_whitespace_only_titles() {
async fn thread_delete_forgets_its_conversation_memory_or_queues_it() {
let _env_lock = crate::config::TEST_ENV_LOCK.lock().await;
let workspace = tempfile::tempdir().expect("workspace");
+ crate::storage::local::use_persistent_default_for_test(workspace.path());
let _workspace_guard = EnvVarGuard::set("OPENHUMAN_WORKSPACE", workspace.path());
let thread_id = "thread-delete-memory";
create_thread_with_title(&workspace, thread_id, "Chat Jan 1 1:00 AM").await;
diff --git a/crates/openhuman-core/src/threads/store/blocking_tests.rs b/crates/openhuman-core/src/threads/store/blocking_tests.rs
index 863c842f3d..c152480297 100644
--- a/crates/openhuman-core/src/threads/store/blocking_tests.rs
+++ b/crates/openhuman-core/src/threads/store/blocking_tests.rs
@@ -251,6 +251,7 @@ async fn concurrent_operations_complete_without_stalling_the_single_async_worker
async fn title_labels_delete_and_purge_round_trip() {
let tmp = TempDir::new().unwrap();
let dir = tmp.path().to_path_buf();
+ crate::storage::local::use_persistent_default_for_test(&dir);
ensure_thread(
crate::core::runtime::DispatchCtx::ambient(),
dir.clone(),
diff --git a/crates/openhuman-core/src/threads/store/transcript_key_tests.rs b/crates/openhuman-core/src/threads/store/transcript_key_tests.rs
index 2efe48664f..374f9ac5b2 100644
--- a/crates/openhuman-core/src/threads/store/transcript_key_tests.rs
+++ b/crates/openhuman-core/src/threads/store/transcript_key_tests.rs
@@ -2,6 +2,7 @@ use super::*;
use crate::core::runtime::DispatchCtx;
fn store(dir: &tempfile::TempDir) -> ConversationStore {
+ crate::storage::local::use_persistent_default_for_test(dir.path());
ConversationStore::new(DispatchCtx::unbound(), dir.path().to_path_buf())
}
@@ -78,6 +79,7 @@ fn deleting_a_thread_forgets_its_key() {
#[tokio::test]
async fn bind_returns_the_recorded_key_and_records_the_first_one() {
let dir = tempfile::tempdir().unwrap();
+ crate::storage::local::use_persistent_default_for_test(dir.path());
let ctx = DispatchCtx::unbound();
let first = bind_transcript_key(&ctx, dir.path(), "thread-a", "orchestrator".into()).await;
let second = bind_transcript_key(&ctx, dir.path(), "thread-a", "researcher".into()).await;