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(agent): keep the per-agent in-flight dedupe test with the lifecycle tests (#7032)
oxoxDev9efd48e4731a
diff --git a/crates/openhuman-core/src/agent/subagent_host/lifecycle.rs b/crates/openhuman-core/src/agent/subagent_host/lifecycle.rsindex 6c3021223c..09629d9ec3 100644--- a/crates/openhuman-core/src/agent/subagent_host/lifecycle.rs+++ b/crates/openhuman-core/src/agent/subagent_host/lifecycle.rs@@ -130,7 +130,7 @@ pub struct OpenHumanSubagentHost {/// independently constructed host adapters. Durable persistence remains the/// cross-process authority; this prevents duplicate local child graphs.#[derive(Clone, Debug, PartialEq, Eq, Hash)]-struct HostLifecycleKey {+pub(super) struct HostLifecycleKey {checkpoint_dir: PathBuf,task_key: SubagentTaskKey,}@@ -212,10 +212,8 @@ fn host_observer_outcome(mut outcome: SubagentRunOutcome) -> SubagentRunOutcomeoutcome}-type HostInFlightMap = AsyncMutex<HashMap<HostLifecycleKey, Arc<HostInFlight>>>;--fn host_in_flight() -> Arc<HostInFlightMap> {- crate::core::runtime::current_slot::<HostInFlightMap>()+pub(super) fn host_in_flight() -> Arc<AsyncMutex<HashMap<HostLifecycleKey, Arc<HostInFlight>>>> {+ crate::core::runtime::current_slot()}fn absolute_checkpoint_dir(path: PathBuf) -> PathBuf {@@ -1306,7 +1304,3 @@ fn outcome_to_host(fn map_lifecycle_error(error: SubagentError) -> SubagentRunError {SubagentRunError::Provider(anyhow::anyhow!(error.to_string()))}--#[cfg(test)]-#[path = "lifecycle_agent_tests.rs"]-mod agent_tests;diff --git a/crates/openhuman-core/src/agent/subagent_host/lifecycle_agent_tests.rs b/crates/openhuman-core/src/agent/subagent_host/lifecycle_agent_tests.rsdeleted file mode 100644index bf6c359230..0000000000--- a/crates/openhuman-core/src/agent/subagent_host/lifecycle_agent_tests.rs+++ /dev/null@@ -1,17 +0,0 @@-use super::*;-use crate::core::runtime::agent_scope::test_agent_context;-use crate::core::runtime::{context::CoreContext, DomainSet};--#[tokio::test]-async fn each_agent_dedupes_its_own_in_flight_sub_agents() {- let root = CoreContext::for_test(DomainSet::full(), None);- let alpha = test_agent_context(&root, "alpha");- let beta = test_agent_context(&root, "beta");-- let alpha_map = CoreContext::scope(Arc::clone(&alpha), async { host_in_flight() }).await;- let beta_map = CoreContext::scope(beta, async { host_in_flight() }).await;- let alpha_again = CoreContext::scope(alpha, async { host_in_flight() }).await;-- assert!(!Arc::ptr_eq(&alpha_map, &beta_map));- assert!(Arc::ptr_eq(&alpha_map, &alpha_again));-}diff --git a/crates/openhuman-core/src/agent/subagent_host/lifecycle_tests.rs b/crates/openhuman-core/src/agent/subagent_host/lifecycle_tests.rsindex 25bd69fc2e..e230176aaf 100644--- a/crates/openhuman-core/src/agent/subagent_host/lifecycle_tests.rs+++ b/crates/openhuman-core/src/agent/subagent_host/lifecycle_tests.rs@@ -4,7 +4,8 @@ use tinyagents_orchestration::subagent::{};use super::lifecycle::{- load_subagent_checkpoint, merged_resume_history, HostInFlight, OpenHumanPersistence,+ host_in_flight, load_subagent_checkpoint, merged_resume_history, HostInFlight,+ OpenHumanPersistence,};use super::{SubagentMode, SubagentRunOutcome, SubagentRunStatus, SubagentUsage};@@ -319,3 +320,21 @@ async fn host_coalescer_keeps_the_leader_winner_and_cancels_only_the_observer()tinyagents_orchestration::subagent::SubagentPersistenceDisposition::TerminalExisting);}++#[tokio::test]+async fn each_agent_dedupes_its_own_in_flight_sub_agents() {+ use crate::core::runtime::agent_scope::test_agent_context;+ use crate::core::runtime::{context::CoreContext, DomainSet};+ use std::sync::Arc;++ let root = CoreContext::for_test(DomainSet::full(), None);+ let alpha = test_agent_context(&root, "alpha");+ let beta = test_agent_context(&root, "beta");++ let alpha_map = CoreContext::scope(Arc::clone(&alpha), async { host_in_flight() }).await;+ let beta_map = CoreContext::scope(beta, async { host_in_flight() }).await;+ let alpha_again = CoreContext::scope(alpha, async { host_in_flight() }).await;++ assert!(!Arc::ptr_eq(&alpha_map, &beta_map));+ assert!(Arc::ptr_eq(&alpha_map, &alpha_again));+}