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): assert per-profile cancellation durability
Steven Enamakelf67484d54298
diff --git a/crates/openhuman-core/src/agent/orchestration/running_subagents_projection_tests.rs b/crates/openhuman-core/src/agent/orchestration/running_subagents_projection_tests.rsindex f24aba1b33..9283486c3a 100644--- a/crates/openhuman-core/src/agent/orchestration/running_subagents_projection_tests.rs+++ b/crates/openhuman-core/src/agent/orchestration/running_subagents_projection_tests.rs@@ -71,20 +71,22 @@ async fn explicit_profile_projects_spawn_completion_and_cancel_without_ambient_salice_rx,).expect("Alice registration");- register(- &bob,- bob_task.clone(),- "researcher".into(),- PARENT.into(),- None,- None,- workspace.path().to_path_buf(),- None,- run_queue(),- dummy_abort(),- bob_rx,- )- .expect("Bob registration");+ CoreContext::sync_scope(alice.resolved().unwrap().clone(), || {+ register(+ &bob,+ bob_task.clone(),+ "researcher".into(),+ PARENT.into(),+ None,+ None,+ workspace.path().to_path_buf(),+ None,+ run_queue(),+ dummy_abort(),+ bob_rx,+ )+ })+ .expect("Bob registration under foreign ambient profile");let alice_spawned = records(&alice, workspace.path());let bob_spawned = records(&bob, workspace.path());@@ -114,10 +116,25 @@ async fn explicit_profile_projects_spawn_completion_and_cancel_without_ambient_s.expect("Alice terminal status projected");assert!(cancel_by_task(&alice, &bob_task).is_none());- assert!(cancel_by_task(&alice, &alice_task).is_some());+ assert!(cancel_by_task(&bob, &bob_task).is_some());let alice_after_cancel = records(&alice, workspace.path());let bob_after_cancel = records(&bob, workspace.path());- assert!(alice_after_cancel.iter().any(|row| row.spec.task_id.as_str() == alice_task));- assert!(bob_after_cancel.iter().any(|row| row.spec.task_id.as_str() == bob_task));+ assert_eq!(+ alice_after_cancel+ .iter()+ .find(|row| row.spec.task_id.as_str() == alice_task)+ .expect("Alice row remains in Alice store")+ .status,+ OrchestrationTaskStatus::Completed+ );+ assert_eq!(+ bob_after_cancel+ .iter()+ .find(|row| row.spec.task_id.as_str() == bob_task)+ .expect("Bob row remains in Bob store")+ .status,+ OrchestrationTaskStatus::Cancelled+ );+ let _ = alice_tx;let _ = bob_tx;}diff --git a/crates/openhuman-core/src/agent/orchestration/running_subagents_tenant_tests.rs b/crates/openhuman-core/src/agent/orchestration/running_subagents_tenant_tests.rsindex 5fc7a97264..8da207943b 100644--- a/crates/openhuman-core/src/agent/orchestration/running_subagents_tenant_tests.rs+++ b/crates/openhuman-core/src/agent/orchestration/running_subagents_tenant_tests.rs@@ -6,6 +6,8 @@ use crate::core::runtime::DispatchCtx;use crate::core::runtime::{ContextOverlay, CoreContext, DomainSet, Mode};use crate::tools::toolpacks::ToolGroups;use tinyagents_orchestration::subagent::SteerError;+use tinyagents_orchestration::subagent::list_subagent_records;+use tinyagents_tasks::OrchestrationTaskStatus;const CHILD: &str = "OPENHUMAN_DETACHED_TENANT_TEST_CHILD";const PARENT: &str = "same-parent-session";@@ -616,9 +618,44 @@ async fn saas_controls_follow_the_explicit_context_not_the_tasks_scope() {"alice reaches her own worker");assert_eq!(b_side.unwrap(), (true, true), "bob reaches his own worker");- assert!(- resume_ref_for_task(&alice, &a_task, PARENT).is_err(),- "each cancel removed only that profile's worker, and it is gone"+ assert!(snapshot_for_parent(&alice, PARENT)+ .iter()+ .all(|worker| worker.task_id != a_task));+ let alice_cancelled = CoreContext::sync_scope(pair.alice.clone(), || {+ list_subagent_records(+ crate::agent::orchestration::running_subagents::resolve::scoped_task_store(+ &alice,+ pair._a_dir.path(),+ )+ .expect("Alice task store")+ .as_ref(),+ )+ });+ let bob_cancelled = CoreContext::sync_scope(pair.bob.clone(), || {+ list_subagent_records(+ crate::agent::orchestration::running_subagents::resolve::scoped_task_store(+ &bob,+ pair._b_dir.path(),+ )+ .expect("Bob task store")+ .as_ref(),+ )+ });+ assert_eq!(+ alice_cancelled+ .iter()+ .find(|row| row.spec.task_id.as_str() == a_task)+ .expect("Alice cancellation remains durable")+ .status,+ OrchestrationTaskStatus::Cancelled+ );+ assert_eq!(+ bob_cancelled+ .iter()+ .find(|row| row.spec.task_id.as_str() == b_task)+ .expect("Bob cancellation remains durable")+ .status,+ OrchestrationTaskStatus::Cancelled);}