The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
test(orchestration): cover durable claim lease across router reopen
Steven Enamakeld28a96624be0
diff --git a/crates/openhuman-core/src/agent/orchestration/background_delivery_tests.rs b/crates/openhuman-core/src/agent/orchestration/background_delivery_tests.rsindex 966d1a8caf..1494929551 100644--- a/crates/openhuman-core/src/agent/orchestration/background_delivery_tests.rs+++ b/crates/openhuman-core/src/agent/orchestration/background_delivery_tests.rs@@ -1,6 +1,6 @@use super::*;use crate::agent::orchestration::background_completions::{- pending_for, record_completion, TestWorkspace,+ forget_workspace_for_test, pending_for, record_completion, router_for_workspace, TestWorkspace,};use std::path::Path;use std::sync::{Arc, Mutex};@@ -70,3 +70,40 @@ async fn try_deliver_applies_the_requested_turn_end_delay() {);assert!(pending_for(&workspace_dir, thread_id).is_empty());}++#[tokio::test]+async fn an_unexpired_completion_claim_stays_leased_after_router_reopen() {+ let _guard = test_guard().await;+ let workspace = TestWorkspace::new();+ let workspace_dir = workspace.path();+ record(+ workspace_dir,+ "bd-claimed-restart",+ "sub-1",+ "claimed before restart",+ "thread-claimed-restart",+ )+ .await;++ let router = router_for_workspace(workspace_dir);+ let claimed = router+ .claim_pending("thread-claimed-restart", usize::MAX)+ .expect("completion claim succeeds");+ assert_eq!(claimed.len(), 1);+ drop(claimed);+ drop(router);+ forget_workspace_for_test(workspace_dir);++ let reopened = router_for_workspace(workspace_dir);+ assert!(+ reopened+ .claim_pending("thread-claimed-restart", usize::MAX)+ .expect("reopened claim succeeds")+ .is_empty(),+ "an unexpired durable claim prevents duplicate delivery after reopening"+ );+ assert_eq!(+ pending_for(workspace_dir, "thread-claimed-restart")[0].task_id,+ "sub-1"+ );+}