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
refactor(tests): remove obsolete delegation tool tests
Steven Enamakel9de527b1aac5
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/dispatch_tests.rs b/crates/openhuman-core/src/agent/orchestration/tools/dispatch_tests.rsindex 1d7362173c..1699c722b2 100644--- a/crates/openhuman-core/src/agent/orchestration/tools/dispatch_tests.rs+++ b/crates/openhuman-core/src/agent/orchestration/tools/dispatch_tests.rs@@ -3,9 +3,6 @@ use async_trait::async_trait;use std::sync::Arc;use tinytools::Tool;-use super::super::delegate_graph::DelegateGraphDispatch;-use crate::tools::delegate::DelegateToolDispatch;-use tinyagents_harness::context::RunConfig;use tinyagents_harness::tool::ToolDispatch;use tinyagents_harness::tools::AskClarificationTool;@@ -14,48 +11,6 @@ struct DelegationRegistrationTool {parameters: serde_json::Value,}-struct BlockingDelegationTool {- started: tokio::sync::mpsc::Sender<()>,-}--struct FailingDelegationTool;--#[async_trait]-impl Tool for BlockingDelegationTool {- fn name(&self) -> &str {- "delegate"- }- fn description(&self) -> &str {- "blocking configured delegate"- }- fn parameters_schema(&self) -> serde_json::Value {- serde_json::json!({})- }- async fn execute(&self, _args: serde_json::Value) -> anyhow::Result<tinytools::ToolResult> {- let _ = self.started.send(()).await;- std::future::pending::<()>().await;- unreachable!("the parent cancellation must win")- }-}--#[async_trait]-impl Tool for FailingDelegationTool {- fn name(&self) -> &str {- "delegate"- }- fn description(&self) -> &str {- "configured delegate that returns a product error"- }- fn parameters_schema(&self) -> serde_json::Value {- serde_json::json!({})- }- async fn execute(&self, _args: serde_json::Value) -> anyhow::Result<tinytools::ToolResult> {- Ok(tinytools::ToolResult::error(- "configured policy rejected the request",- ))- }-}-#[async_trait]impl Tool for DelegationRegistrationTool {fn name(&self) -> &str {@@ -93,18 +48,6 @@ fn typed_dispatch_registration_recognises_every_synthesised_delegate_surface() {);}-#[test]-fn delegate_graph_is_not_misclassified_as_an_archetype_delegate() {- let graph: Arc<dyn Tool> = Arc::new(DelegationRegistrationTool {- name: "delegate_graph",- parameters: serde_json::json!({}),- });- assert!(- DelegationDispatch::for_tool(graph, None).is_none(),- "delegate_graph must retain its dedicated durable-graph dispatcher"- );-}-#[test]fn archetype_dispatch_uses_the_registered_target_marker_not_ambient_names() {let tool: Arc<dyn Tool> = Arc::new(super::super::ArchetypeDelegationTool {@@ -123,130 +66,6 @@ fn archetype_dispatch_uses_the_registered_target_marker_not_ambient_names() {);}-#[tokio::test]-async fn delegate_graph_dispatch_uses_its_durable_graph_argument_path() {- let tool: Arc<dyn Tool> = Arc::new(DelegationRegistrationTool {- name: "delegate_graph",- parameters: serde_json::json!({}),- });- let dispatch = DelegateGraphDispatch::new(tool);- let parent = crate::agent::tinyagents::host::OpenHumanRunContext::new()- .into_tinyagents(RunConfig::new("delegate-graph-parent"));-- let result = dispatch- .execute(- &(),- tinyagents_harness::CallId::new("test-call"),- serde_json::json!({"task": "review this change"}),- tinytools::ToolCallOptions::default(),- &parent,- )- .await- .expect("dedicated dispatcher returns a tool result");- assert!(result.is_error);- assert!(- result.output().contains("`agent_id` is required"),- "delegate_graph must execute its concrete graph validation, not an archetype lookup: {}",- result.output()- );-}--#[tokio::test]-async fn config_delegate_dispatch_honours_the_parent_cancellation_token() {- let (started_tx, mut started_rx) = tokio::sync::mpsc::channel(1);- let tool: Arc<dyn Tool> = Arc::new(BlockingDelegationTool {- started: started_tx,- });- let dispatch = DelegateToolDispatch::new(tool);- let cancellation = tinyagents_harness::CancellationToken::new();- let core = crate::core::runtime::CoreContext::for_test_with_config(- crate::core::runtime::DomainSet::full(),- crate::config::Config::default(),- );- let parent = crate::agent::tinyagents::host::OpenHumanRunContext::new()- .with_core(Some(Arc::clone(&core)))- .with_cancellation(cancellation.clone())- .into_tinyagents(RunConfig::new("config-delegate-parent").with_thread("thread-parent"));- let jobs = crate::core::runtime::slot_for::<- tinyagents_orchestration::subagent::SubAgentJobRegistry,- >(&parent.data.dispatch_ctx());- let execution = dispatch.execute(- &(),- tinyagents_harness::CallId::new("test-call"),- serde_json::json!({"agent": "configured", "prompt": "work"}),- tinytools::ToolCallOptions::default(),- &parent,- );- tokio::pin!(execution);- tokio::select! {- _ = started_rx.recv() => {- assert!(jobs.list().iter().any(|job| {- job.agent == "configured"- && job.status == tinyagents_orchestration::subagent::SubAgentJobStatus::Running- }), "configured executor is registered in the shared Jobs lifecycle");- cancellation.cancel();- },- result = &mut execution => panic!("blocking delegate returned before cancellation: {result:?}"),- }- let result = execution- .await- .expect("cancellation is reported as a tool result");- assert!(result.is_error);- assert!(result.output().contains("cancelled"), "{}", result.output());- let cancelled = jobs- .list()- .into_iter()- .find(|job| job.agent == "configured")- .expect("configured child remains in the isolated shared registry");- assert_eq!(- cancelled.status,- tinyagents_orchestration::subagent::SubAgentJobStatus::Cancelled,- "configured child cancellation settles as Cancelled"- );-}--#[tokio::test]-async fn config_delegate_dispatch_preserves_tool_failure_in_shared_jobs() {- let dispatch = DelegateToolDispatch::new(Arc::new(FailingDelegationTool));- let core = crate::core::runtime::CoreContext::for_test_with_config(- crate::core::runtime::DomainSet::full(),- crate::config::Config::default(),- );- let parent = crate::agent::tinyagents::host::OpenHumanRunContext::new()- .with_core(Some(Arc::clone(&core)))- .into_tinyagents(RunConfig::new("config-delegate-error-parent"));- let jobs = crate::core::runtime::slot_for::<- tinyagents_orchestration::subagent::SubAgentJobRegistry,- >(&parent.data.dispatch_ctx());-- let result = dispatch- .execute(- &(),- tinyagents_harness::CallId::new("configured-error-call"),- serde_json::json!({"agent": "configured-error", "prompt": "work"}),- tinytools::ToolCallOptions::default(),- &parent,- )- .await- .expect("the host returns the configured tool result");-- assert!(result.is_error);- assert!(result- .output()- .contains("configured policy rejected the request"));- assert!(- jobs.list().iter().any(|job| {- job.agent == "configured-error"- && job.status == tinyagents_orchestration::subagent::SubAgentJobStatus::Incomplete- && job- .output- .as_deref()- .is_some_and(|error| error.contains("configured policy rejected the request"))- }),- "the registered job retains the configured product failure"- );-}-#[test]fn ask_clarification_tool_is_the_harness_tool() {let tool = AskClarificationTool::new();diff --git a/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_continuation_tests.rs b/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_continuation_tests.rsindex c5135023f9..bd15cfd49b 100644--- a/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_continuation_tests.rs+++ b/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_continuation_tests.rs@@ -327,80 +327,3 @@ async fn cancelling_a_paused_driver_through_rpc_settles_once_with_its_reason() {assert!(!parent_cancellation.is_cancelled());}-#[tokio::test]-async fn delegate_graph_runs_every_stage_through_shared_driver_jobs() {- use crate::agent::orchestration::tools::DelegateGraphTool;- use crate::agent_registry::host_definition::AgentDefinitionRegistry;- use crate::core::runtime::{ContextOverlay, CoreContext, DomainSet};- use crate::tools::toolpacks::ToolGroups;- use tinyagents_orchestration::subagent::{SubAgentJobRegistry, SubAgentJobStatus};-- let _ = AgentDefinitionRegistry::init_global_builtins();- let workspace = tempfile::TempDir::new().expect("workspace");- let provider = Arc::new(ScriptedModel::new(vec![- ("Produce a short, concrete", "1. inspect the fixture"),- ("Carry out the plan below", "graph-stage-execution-canary"),- ("Review the result below", "APPROVE\nThe result is correct."),- ]));- let mut parent = parent_context(workspace.path(), provider.clone(), vec![]);- parent.session_id = "delegate-graph-jobs-e2e".into();- let mut test_definition = AgentDefinitionRegistry::builtins_only()- .get("task_manager_agent")- .expect("task manager definition")- .clone();- test_definition.model = tinyagents_definition::ModelSpec::Exact("test-model".into());- let definitions =- Arc::new(AgentDefinitionRegistry::builtins_only().with_definitions([test_definition]));- let mut config = crate::config::Config::default();- config.workspace_dir = workspace.path().to_path_buf();- let core = CoreContext::for_test_with_config(DomainSet::full(), config.clone()).derive_with(- ContextOverlay::new(config, DomainSet::full(), ToolGroups::none()).definitions(definitions),- );- // `OpenHumanRunContext::with_core` retains a weak handle; keep this strong- // owner alive through the graph execution so the scoped definition- // catalogue is the one the live parent carries.- let live = Arc::new(- crate::agent::tinyagents::host::OpenHumanRunContext::new()- .with_core(Some(Arc::clone(&core)))- .with_parent(parent)- .into_tinyagents(tinyagents_harness::context::RunConfig::new(- "delegate-graph-jobs-e2e",- )),- );- let result = DelegateGraphTool::new()- .execute_with_live_parent_context(- json!({- "agent_id": "task_manager_agent",- "task": "Verify the driver-backed graph stage fixture",- "max_revisions": 1- }),- None,- live.data.child(),- Some(Arc::clone(&live)),- )- .await- .expect("graph delegation returns a tool result");-- assert!(!result.is_error, "{}", result.output());- assert!(result.output().contains("graph-stage-execution-canary"));- assert_eq!(provider.seen.lock().len(), 3);-- let jobs = crate::core::runtime::slot_for::<SubAgentJobRegistry>(&live.data.dispatch_ctx());- let completed_stages = jobs- .list()- .into_iter()- .filter(|job| {- job.agent == "task_manager_agent"- && job.status == SubAgentJobStatus::Completed- && job.output.as_deref().is_some_and(|output| {- output.contains("1. inspect the fixture")- || output.contains("graph-stage-execution-canary")- || output.contains("APPROVE")- })- })- .count();- assert_eq!(- completed_stages, 3,- "each graph stage is registered in Jobs"- );-}