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: cover cron completion ownership and per-scope connection handling
Steven Enamakeldfc3c477e3c7
diff --git a/crates/openhuman-core/src/desktop/notifications/bus_tests_2_tests.rs b/crates/openhuman-core/src/desktop/notifications/bus_tests_2_tests.rsindex f2ea724fd3..dcb88d255c 100644--- a/crates/openhuman-core/src/desktop/notifications/bus_tests_2_tests.rs+++ b/crates/openhuman-core/src/desktop/notifications/bus_tests_2_tests.rs@@ -528,3 +528,39 @@ fn the_announcement_rule_fails_closed_on_an_unknown_workspace() {// whoever is connected.assert!(!announces_to(Some(a), None));}++/// A cron job that completed as an agent is stored with that agent: the+/// scheduler's note names it even when the job is already gone.+#[tokio::test]+async fn a_noted_cron_completion_names_its_agent() {+ let context = crate::core::runtime::CoreContext::for_test(+ crate::core::runtime::DomainSet::full(),+ None,+ )+ .derive_with(+ crate::core::runtime::ContextOverlay::new(+ crate::config::Config::default(),+ crate::core::runtime::DomainSet::full(),+ Default::default(),+ )+ .session_agent("notif-owner-agent"),+ );+ crate::core::runtime::CoreContext::scope(context, async {+ crate::cron::completion_owner::note("notif-owner-job");+ })+ .await;+ let event = DomainEvent::CronJobCompleted {+ job_id: "notif-owner-job".into(),+ success: true,+ output: String::new(),+ };+ let owner = event_owner(&crate::config::Config::default(), &event).await;+ assert_eq!(owner, Ok(Some("notif-owner-agent".to_string())));+ // Taken: asked again, the job is no one's (no backend installed here).+ if crate::storage::installed().is_none() {+ assert_eq!(+ event_owner(&crate::config::Config::default(), &event).await,+ Ok(None)+ );+ }+}diff --git a/crates/openhuman-core/src/integrations/task_sources/bus_tests.rs b/crates/openhuman-core/src/integrations/task_sources/bus_tests.rsindex ece2eb15f2..b758536640 100644--- a/crates/openhuman-core/src/integrations/task_sources/bus_tests.rs+++ b/crates/openhuman-core/src/integrations/task_sources/bus_tests.rs@@ -59,3 +59,33 @@ async fn an_unreadable_scope_is_skipped() {};fire_for_connection(&config, ProviderSlug::Github, "github", "conn-1").await;}++/// The subscriber handles a connection event through each scope's own+/// configuration: toolkits that are not task sources are ignored, and a+/// scope whose configuration disables task sources fires nothing.+#[tokio::test]+async fn a_connection_event_is_handled_per_scope() {+ let _lock = crate::config::TEST_ENV_LOCK.lock().await;+ let workspace = tempfile::TempDir::new().unwrap();+ let _guard = crate::config::test_env::EnvVarGuard::workspace_unlocked(workspace.path());+ let event = |toolkit: &str| DomainEvent::ComposioConnectionCreated {+ toolkit: toolkit.to_string(),+ connection_id: "conn-1".to_string(),+ connect_url: String::new(),+ };+ // Not a task-source toolkit.+ TaskSourcesConnectionSubscriber+ .handle(&event("not-a-toolkit"))+ .await;+ // A task-source toolkit: the local scope loads its configuration and+ // fires (or skips) its sources.+ TaskSourcesConnectionSubscriber.handle(&event("github")).await;+ // An event of another kind is ignored.+ TaskSourcesConnectionSubscriber+ .handle(&DomainEvent::ComposioConnectionDeleted {+ toolkit: "github".to_string(),+ connection_id: "conn-1".to_string(),+ })+ .await;+ fire_in_scope(ProviderSlug::Github, "github", "conn-1").await;+}