Skip to content

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

test(session_store): cover storage url installation paths

Steven Enamakel102c5a5961c8
diff --git a/crates/openhuman-rpc/src/session_store/mod_tests.rs b/crates/openhuman-rpc/src/session_store/mod_tests.rs
index 009c79c204..e90bea2502 100644
--- a/crates/openhuman-rpc/src/session_store/mod_tests.rs
+++ b/crates/openhuman-rpc/src/session_store/mod_tests.rs
@@ -48,3 +48,58 @@ fn recovery_interrupts_turns_left_in_flight() {
Some(TurnLifecycle::Interrupted)
);
}
+
+/// The provider and storage slots are process-wide; these tests take turns.
+static SLOTS: Mutex<()> = Mutex::new(());
+
+#[tokio::test]
+async fn a_storage_url_installs_the_driver_backed_store() {
+ let _turn = SLOTS.lock().unwrap_or_else(std::sync::PoisonError::into_inner);
+ let previous = openhuman_core::agent::session_store::installed();
+ install_for_url(Some("memory".into())).await.unwrap();
+
+ let provider = openhuman_core::agent::session_store::installed().unwrap();
+ assert!(
+ provider
+ .destination_key()
+ .is_some_and(|key| key.starts_with("memory://")),
+ "{:?}",
+ provider.destination_key()
+ );
+ assert_eq!(
+ openhuman_core::storage::installed().map(|b| b.driver()),
+ Some("memory")
+ );
+ // Agents are kept apart in the shared backend.
+ let alice = provider.for_agent("alice");
+ alice
+ .turn_states
+ .put(&TurnState::started("t", "r", 8, "2026-01-01T00:00:00Z"))
+ .unwrap();
+ assert!(provider.for_agent("bob").turn_states.get("t").unwrap().is_none());
+
+ openhuman_core::storage::clear();
+ openhuman_core::agent::session_store::restore(previous);
+}
+
+#[tokio::test]
+async fn no_url_keeps_the_classic_layout() {
+ let _turn = SLOTS.lock().unwrap_or_else(std::sync::PoisonError::into_inner);
+ let previous = openhuman_core::agent::session_store::installed();
+ install_for_url(None).await.unwrap();
+ let provider = openhuman_core::agent::session_store::installed().unwrap();
+ assert!(provider.workspace_dir().is_some(), "the file layout is installed");
+ assert!(openhuman_core::storage::installed().is_none());
+ openhuman_core::agent::session_store::restore(previous);
+}
+
+#[tokio::test]
+async fn an_unusable_url_fails_the_boot() {
+ let _turn = SLOTS.lock().unwrap_or_else(std::sync::PoisonError::into_inner);
+ let previous = openhuman_core::agent::session_store::installed();
+ let error = install_for_url(Some("ftp://nowhere".into()))
+ .await
+ .unwrap_err();
+ assert!(format!("{error:#}").contains("storage"), "{error:#}");
+ openhuman_core::agent::session_store::restore(previous);
+}