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
chore: files changed crates/openhuman-core/src/flows/bus_subscriber_tests.rs
Steven Enamakelb54c9eb0340c
diff --git a/crates/openhuman-core/src/flows/bus_subscriber_tests.rs b/crates/openhuman-core/src/flows/bus_subscriber_tests.rsindex 746332878b..537266fb93 100644--- a/crates/openhuman-core/src/flows/bus_subscriber_tests.rs+++ b/crates/openhuman-core/src/flows/bus_subscriber_tests.rs@@ -196,6 +196,79 @@ fn try_acquire_dispatch_skips_a_flow_already_in_flight() {);}+#[tokio::test]+async fn app_event_runs_queue_fifo_per_tenant_while_other_tenants_progress() {+ use crate::core::runtime::{ContextOverlay, CoreContext, DispatchCtx, DomainSet};+ use std::sync::Mutex;+ use tokio::sync::{mpsc, oneshot};++ let tmp = tempfile::TempDir::new().unwrap();+ let config = test_config(&tmp);+ let (completed_tx, mut completed_rx) = mpsc::unbounded_channel();+ let (started_tx, started_rx) = oneshot::channel();+ let started_tx = Arc::new(Mutex::new(Some(started_tx)));+ let (release_first_tx, release_first_rx) = oneshot::channel();+ let release_first_rx = Arc::new(tokio::sync::Mutex::new(Some(release_first_rx)));+ let runner = Arc::new(move |ctx, flow_id, input, _inputs, _trigger| {+ let completed_tx = completed_tx.clone();+ let started_tx = Arc::clone(&started_tx);+ let release_first_rx = Arc::clone(&release_first_rx);+ Box::pin(async move {+ let tenant = ctx.tenant().unwrap();+ let event = input["event"].as_str().unwrap().to_owned();+ if event == "a1" {+ if let Some(started_tx) = started_tx.lock().unwrap().take() {+ let _ = started_tx.send(());+ }+ if let Some(release) = release_first_rx.lock().await.take() {+ let _ = release.await;+ }+ }+ completed_tx+ .send((tenant.agent.unwrap(), flow_id, event))+ .unwrap();+ })+ });+ let subscriber = FlowTriggerSubscriber::with_runner(config, runner, 1);+ let context = |agent: &str| {+ DispatchCtx::new(+ CoreContext::for_test(DomainSet::full(), None).derive_with(+ ContextOverlay::new(Config::default(), DomainSet::full(), Default::default())+ .session_agent(agent),+ ),+ )+ };+ let tenant_a = context("tenant-a");+ let tenant_b = context("tenant-b");++ subscriber+ .dispatch_app_event(&tenant_a, "shared-flow", json!({"event": "a1"}))+ .await;+ started_rx.await.unwrap();+ subscriber+ .dispatch_app_event(&tenant_a, "shared-flow", json!({"event": "a2"}))+ .await;+ subscriber+ .dispatch_app_event(&tenant_b, "shared-flow", json!({"event": "b1"}))+ .await;++ assert_eq!(+ completed_rx.recv().await.unwrap(),+ ("tenant-b".to_string(), "shared-flow".to_string(), "b1".to_string()),+ "a held run for one tenant must not block the same flow id for another tenant"+ );+ release_first_tx.send(()).unwrap();+ assert_eq!(+ completed_rx.recv().await.unwrap(),+ ("tenant-a".to_string(), "shared-flow".to_string(), "a1".to_string())+ );+ assert_eq!(+ completed_rx.recv().await.unwrap(),+ ("tenant-a".to_string(), "shared-flow".to_string(), "a2".to_string()),+ "app_event payloads for one tenant and flow must execute FIFO"+ );+}+#[test]fn default_constructs_the_same_as_new() {let tmp = tempfile::TempDir::new().unwrap();