Skip to content

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

test(orchestration): update delivery slot release logic

Steven Enamakel2255878ad133
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 df55db2170..983a7905fb 100644
--- a/crates/openhuman-core/src/agent/orchestration/background_completions_tests.rs
+++ b/crates/openhuman-core/src/agent/orchestration/background_completions_tests.rs
@@ -436,10 +436,14 @@ fn undelivered_completions_are_found_again_after_a_restart() {
Some("thread-boot-done"),
);
let router = router_for_workspace(w);
- router
+ let claimed = router
.claim_pending("thread-boot-done", usize::MAX)
.unwrap();
- router.mark_delivered(&["sub-2"]).unwrap();
+ let receipts: Vec<_> = claimed
+ .iter()
+ .map(|record| record.receipt().expect("claimed record has receipt"))
+ .collect();
+ router.mark_delivered(&receipts).unwrap();
drop(router);
forget_workspace_for_test(w);
@@ -509,19 +513,20 @@ fn clear_all_also_withdraws_a_completion_a_delivery_has_leased() {
record(w, "sess-l", "sub-1", "x", Some("thread-leased"));
let router = router_for_workspace(w);
// A delivery claimed it: the record is leased but still pending in the store.
- assert_eq!(
- router
- .claim_pending("thread-leased", usize::MAX)
- .unwrap()
- .len(),
- 1
- );
+ let claimed = router
+ .claim_pending("thread-leased", usize::MAX)
+ .unwrap();
+ assert_eq!(claimed.len(), 1);
+ let receipts: Vec<_> = claimed
+ .iter()
+ .map(|record| record.receipt().expect("claimed record has receipt"))
+ .collect();
assert_eq!(clear_all(&cx(), w), 1);
assert!(pending_ids(w, "thread-leased").is_empty());
assert_eq!(
- router.mark_delivered(&["sub-1"]).unwrap(),
+ router.mark_delivered(&receipts).unwrap(),
0,
"nothing left to settle"
);
diff --git a/crates/openhuman-core/src/agent/orchestration/background_delivery_slots_tests.rs b/crates/openhuman-core/src/agent/orchestration/background_delivery_slots_tests.rs
index 446b497473..f4101dc0e8 100644
--- a/crates/openhuman-core/src/agent/orchestration/background_delivery_slots_tests.rs
+++ b/crates/openhuman-core/src/agent/orchestration/background_delivery_slots_tests.rs
@@ -100,7 +100,11 @@ async fn one_profiles_busy_turn_does_not_block_anothers_thread() {
})
.expect("bob's thread is idle while alice's turn runs");
assert_eq!(batch[0].task_id, "task-bob");
- router_b.release(&["task-bob".to_string()]);
+ let receipts: Vec<_> = batch
+ .iter()
+ .map(|record| record.receipt().expect("claimed record has receipt"))
+ .collect();
+ router_b.release(&receipts);
// Bob's Stop clears only Bob's turns; Alice stays busy.
assert_eq!(