Skip to content

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

test(session_host): cover legacy read failure during first admission

Steven Enamakel901bee19e0d4
diff --git a/crates/openhuman-core/src/agent/session_host/imported_history_tests.rs b/crates/openhuman-core/src/agent/session_host/imported_history_tests.rs
index 922e244e72..83092fa753 100644
--- a/crates/openhuman-core/src/agent/session_host/imported_history_tests.rs
+++ b/crates/openhuman-core/src/agent/session_host/imported_history_tests.rs
@@ -209,6 +209,17 @@ async fn legacy_history_is_loaded_only_for_an_unwritten_bound_session() {
let session = host.bound_session_ref().expect("bound session").clone();
assert!(!host.bound_history_is_authoritative().unwrap());
+ let absent = host
+ .adopt_legacy_history_if_needed(|| async {
+ Err(anyhow::anyhow!("legacy store unavailable"))
+ })
+ .await;
+ assert!(absent.is_err(), "legacy read failure must stop first admission");
+ assert!(
+ !locator.session_exists(&session),
+ "failed legacy read must not create an absent session"
+ );
+
// Merely opening the exact transcript handle does not count as a durable
// turn and must not suppress the one-time legacy import.
let now = chrono::Utc::now().to_rfc3339();