Skip to content

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

test(orchestration): await completion recording in fallback test

Steven Enamakelcb90c63aee38
diff --git a/crates/openhuman-core/src/agent/orchestration/background_completions_tests.rs b/crates/openhuman-core/src/agent/orchestration/background_completions_tests.rs
index 6e931d542a..b616574855 100644
--- a/crates/openhuman-core/src/agent/orchestration/background_completions_tests.rs
+++ b/crates/openhuman-core/src/agent/orchestration/background_completions_tests.rs
@@ -701,14 +701,22 @@ impl CompletionStore for FullDisk {
}
}
-#[test]
-fn a_store_that_keeps_failing_degrades_to_memory_instead_of_losing_the_result() {
- let _guard = test_guard();
+#[tokio::test]
+async fn a_store_that_keeps_failing_degrades_to_memory_instead_of_losing_the_result() {
+ let _guard = crate::config::TEST_ENV_LOCK.lock().await;
let ws = workspace();
let w = ws.path();
install_store_for_test(w, Arc::new(FullDisk(InMemoryCompletionStore::new())));
- record(w, "sess-fd", "sub-1", "must not be lost", Some("thread-fd"));
+ record_completion(
+ w,
+ "sess-fd",
+ "sub-1",
+ "researcher",
+ "must not be lost",
+ Some("thread-fd".into()),
+ )
+ .await;
let pending = pending_for(w, "thread-fd");
assert_eq!(pending.len(), 1, "the result is held in memory");
diff --git a/crates/openhuman-core/src/agent/orchestration/background_delivery.rs b/crates/openhuman-core/src/agent/orchestration/background_delivery.rs
index b629311b54..482277dfff 100644
--- a/crates/openhuman-core/src/agent/orchestration/background_delivery.rs
+++ b/crates/openhuman-core/src/agent/orchestration/background_delivery.rs
@@ -291,9 +291,7 @@ where
// turn on the same thread. Skip if a delivery is already in flight. The
// guard frees the slot, and any lease still held, even if this future is
// dropped mid-turn.
- let Some(mut slot) = DeliverySlot::claim(&thread_id, router.clone()) else {
- return None;
- };
+ let mut slot = DeliverySlot::claim(&thread_id, router.clone())?;
// A busy thread defers *before* the claim: the claim counts a delivery
// attempt, and a user who keeps typing must not burn a record's budget.