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): replace run_subagent with run_host_from_test_options
Steven Enamakel587904e2d626
diff --git a/crates/openhuman-core/src/agent/subagent_host/ops_tests.rs b/crates/openhuman-core/src/agent/subagent_host/ops_tests.rsindex d460fcc043..20db91a953 100644--- a/crates/openhuman-core/src/agent/subagent_host/ops_tests.rs+++ b/crates/openhuman-core/src/agent/subagent_host/ops_tests.rs@@ -249,6 +249,19 @@ fn tool_response(name: &str, args: &str) -> ModelResponse {/// Uses a no-op memory backend so we don't have to spin up a real one./// `options` with `parent` bound as the run's explicit parent execution/// context, the way a spawning tool or orchestration surface supplies it.+async fn run_host_from_test_options(+ definition: &AgentDefinition,+ input: &str,+ options: SubagentRunOptions,+) -> Result<SubagentRunOutcome, SubagentRunError> {+ let mut root_data = options.run_context.clone();+ let root_config = root_data.root_run_config("subagent-host-test");+ let parent = root_data.into_tinyagents(root_config);+ crate::agent::subagent_host::OpenHumanSubagentHost::new(definition.clone(), options)+ .run(&parent, input.to_owned())+ .await+}+fn with_parent(parent: ParentExecutionContext,mut options: SubagentRunOptions,diff --git a/crates/openhuman-core/src/agent/subagent_host/ops_tests_model_resolution_tests.rs b/crates/openhuman-core/src/agent/subagent_host/ops_tests_model_resolution_tests.rsindex a665d6c8ab..0ba7cd91b6 100644--- a/crates/openhuman-core/src/agent/subagent_host/ops_tests_model_resolution_tests.rs+++ b/crates/openhuman-core/src/agent/subagent_host/ops_tests_model_resolution_tests.rs@@ -1,9 +1,8 @@use super::*;-use crate::agent::subagent_host::run_subagent;use crate::agent::subagent_host::{- run_subagent_via_driver_tool, spawn_async_via_driver_tool_with_jobs, SubagentRunStatus,+ SubagentRunStatus, run_subagent_via_driver_tool, spawn_async_via_driver_tool_with_jobs,};-use tinyagents_harness::context::{current_run_depth, with_run_depth, RunDepth};+use tinyagents_harness::context::{RunDepth, current_run_depth, with_run_depth};struct BlockingSubagentCloseTool {started: tokio::sync::mpsc::Sender<()>,@@ -46,7 +45,7 @@ async fn runner_rejects_spawn_beyond_max_depth() {max_depth: MAX_SPAWN_DEPTH,},async {- run_subagent(+ run_host_from_test_options(&def,"x",with_parent(parent.clone(), SubagentRunOptions::default()),@@ -87,7 +86,7 @@ async fn typed_mode_model_override_pins_exact_model_for_spawn() {def.model = ModelSpec::Inherit;let _ = (async {- run_subagent(+ run_host_from_test_options(&def,"use the pinned model",with_parent(@@ -131,7 +130,7 @@ async fn typed_mode_emits_child_progress_events_when_sink_attached() {let def = make_def_named_tools(&["file_read"]);let outcome = (async {- run_subagent(+ run_host_from_test_options(&def,"read x",with_parent(parent, SubagentRunOptions::default()),@@ -211,7 +210,7 @@ async fn typed_mode_forwards_child_text_and_thinking_deltas() {let def = make_def_named_tools(&[]);let outcome = (async {- run_subagent(+ run_host_from_test_options(&def,"answer me",with_parent(parent, SubagentRunOptions::default()),@@ -289,7 +288,7 @@ async fn typed_mode_progress_emission_is_a_noop_without_sink() {assert!(parent.on_progress.is_none());let def = make_def_named_tools(&[]);let outcome = (async {- run_subagent(+ run_host_from_test_options(&def,"x",with_parent(parent.clone(), SubagentRunOptions::default()),@@ -613,7 +612,7 @@ fn nested_subagent_dispatch_runs_on_a_constrained_worker_stack() {.get().cloned().expect("parent set before the run");- let outcome = run_subagent(+ let outcome = run_host_from_test_options(&self.inner_def,"inner go",with_parent(parent, SubagentRunOptions::default()),@@ -657,7 +656,7 @@ fn nested_subagent_dispatch_runs_on_a_constrained_worker_stack() {let outer_def = make_def_named_tools(&["delegate_inner"]);(async {- run_subagent(+ run_host_from_test_options(&outer_def,"outer go",with_parent(parent.clone(), SubagentRunOptions::default()),diff --git a/crates/openhuman-core/src/agent/subagent_host/ops_tests_slug_filter_typed_mode_tests.rs b/crates/openhuman-core/src/agent/subagent_host/ops_tests_slug_filter_typed_mode_tests.rsindex 4b321f3ad0..524a403f24 100644--- a/crates/openhuman-core/src/agent/subagent_host/ops_tests_slug_filter_typed_mode_tests.rs+++ b/crates/openhuman-core/src/agent/subagent_host/ops_tests_slug_filter_typed_mode_tests.rs@@ -1,6 +1,5 @@use super::*;-use crate::agent::subagent_host::run_subagent;-use tinyagents_harness::context::{current_run_depth, with_run_depth, RunDepth};+use tinyagents_harness::context::{RunDepth, current_run_depth, with_run_depth};#[test]fn filter_named_scope_keeps_only_named() {@@ -80,7 +79,7 @@ async fn typed_mode_injects_current_date_and_time_into_user_message() {let def = make_def_named_tools(&[]);let _ = (async {- run_subagent(+ run_host_from_test_options(&def,"the actual task prompt",with_parent(parent.clone(), SubagentRunOptions::default()),@@ -110,7 +109,7 @@ async fn typed_mode_system_prompt_includes_subagent_role_contract() {let def = make_def_named_tools(&[]);let _ = (async {- run_subagent(+ run_host_from_test_options(&def,"the actual task prompt",with_parent(parent.clone(), SubagentRunOptions::default()),@@ -126,12 +125,16 @@ async fn typed_mode_system_prompt_includes_subagent_role_contract() {.iter().find(|m| m.role == "system").expect("system message should be present");- assert!(system_msg- .content- .contains("You are a subagent (depth 1) working for a parent agent, not the end user."));- assert!(system_msg- .content- .contains("Your assignment: the actual task prompt"));+ assert!(+ system_msg+ .content+ .contains("You are a subagent (depth 1) working for a parent agent, not the end user.")+ );+ assert!(+ system_msg+ .content+ .contains("Your assignment: the actual task prompt")+ );for heading in ["Answer","Evidence used",@@ -145,9 +148,11 @@ async fn typed_mode_system_prompt_includes_subagent_role_contract() {"missing {heading} heading");}- assert!(system_msg- .content- .contains("Do not state unsupported facts; disclose truncated or partial tool results."));+ assert!(+ system_msg.content.contains(+ "Do not state unsupported facts; disclose truncated or partial tool results."+ )+ );}#[tokio::test]@@ -190,7 +195,7 @@ async fn typed_mode_uses_inherited_workspace_for_project_instructions() {},);- run_subagent(&make_def_named_tools(&[]), "the requested task", options)+ run_host_from_test_options(&make_def_named_tools(&[]), "the requested task", options).await.expect("subagent run should complete");@@ -211,7 +216,7 @@ async fn typed_mode_returns_text_through_runner() {let def = make_def_named_tools(&[]);let outcome = (async {- run_subagent(+ run_host_from_test_options(&def,"summarise X",with_parent(@@ -266,7 +271,7 @@ async fn capped_no_progress_subagent_returns_incomplete_status() {def.max_iterations = 2;let outcome = (async {- run_subagent(+ run_host_from_test_options(&def,"read the file",with_parent(parent.clone(), SubagentRunOptions::default()),@@ -320,7 +325,7 @@ async fn run_queue_steer_lands_in_subagent_history() {.await;let outcome = (async {- run_subagent(+ run_host_from_test_options(&def,"investigate the bug",with_parent(@@ -365,7 +370,7 @@ async fn typed_mode_no_memory_context_in_user_message() {let def = make_def_named_tools(&[]);let _ = (async {- run_subagent(+ run_host_from_test_options(&def,"the actual task prompt",with_parent(parent.clone(), SubagentRunOptions::default()),@@ -401,7 +406,7 @@ async fn typed_mode_includes_memory_context_when_definition_allows_it() {def.extensions.omit_memory_context = false;let _ = (async {- run_subagent(+ run_host_from_test_options(&def,"the actual task prompt",with_parent(parent.clone(), SubagentRunOptions::default()),@@ -441,7 +446,7 @@ async fn typed_mode_filters_tools_by_skill_filter() {def.tools = ToolScope::Wildcard;let _ = (async {- run_subagent(+ run_host_from_test_options(&def,"lookup",with_parent(@@ -501,7 +506,7 @@ async fn typed_mode_executes_one_tool_then_returns() {let def = make_def_named_tools(&["file_read"]);let outcome = (async {- run_subagent(+ run_host_from_test_options(&def,"read x",with_parent(parent.clone(), SubagentRunOptions::default()),@@ -542,7 +547,7 @@ async fn typed_mode_blocks_unallowed_tool_calls() {let def = make_def_named_tools(&["file_read"]);let outcome = (async {- run_subagent(+ run_host_from_test_options(&def,"do thing",with_parent(parent.clone(), SubagentRunOptions::default()),@@ -581,7 +586,7 @@ async fn typed_mode_blocks_unallowed_tool_calls() {#[tokio::test]async fn runner_errors_outside_parent_context() {let def = make_def_named_tools(&[]);- let result = run_subagent(&def, "x", SubagentRunOptions::default()).await;+ let result = run_host_from_test_options(&def, "x", SubagentRunOptions::default()).await;assert!(matches!(result, Err(SubagentRunError::NoParentContext)));}@@ -603,7 +608,7 @@ async fn subagent_emits_checkpoint_at_iteration_cap_instead_of_erroring() {def.max_iterations = 2;let outcome = (async {- run_subagent(+ run_host_from_test_options(&def,"keep reading forever",with_parent(parent.clone(), SubagentRunOptions::default()),@@ -635,7 +640,7 @@ async fn subagent_checkpoint_falls_back_to_deterministic_when_summary_empty() {def.max_iterations = 2;let outcome = (async {- run_subagent(+ run_host_from_test_options(&def,"keep reading forever",with_parent(parent.clone(), SubagentRunOptions::default()),@@ -670,7 +675,7 @@ async fn runner_allows_spawn_at_max_depth() {max_depth: MAX_SPAWN_DEPTH,},async {- run_subagent(+ run_host_from_test_options(&def,"x",with_parent(parent.clone(), SubagentRunOptions::default()),diff --git a/crates/openhuman-core/src/agent/subagent_host/ops_tests_tier_gate_tests.rs b/crates/openhuman-core/src/agent/subagent_host/ops_tests_tier_gate_tests.rsindex 881cacb538..87b87ab0b4 100644--- a/crates/openhuman-core/src/agent/subagent_host/ops_tests_tier_gate_tests.rs+++ b/crates/openhuman-core/src/agent/subagent_host/ops_tests_tier_gate_tests.rs@@ -1,5 +1,4 @@use super::*;-use crate::agent::subagent_host::run_subagent;#[test]fn tier_gate_skips_when_parent_unresolved() {@@ -107,7 +106,7 @@ async fn dispatch_is_refused_after_the_turn_requests_a_graceful_pause() {dispatch.record_pause_requested(15, 15);let mut options = SubagentRunOptions::default();options.run_context.dispatch = Some(dispatch);- let outcome = run_subagent(&definition, "task", options).await;+ let outcome = run_host_from_test_options(&definition, "task", options).await;assert!(matches!(@@ -130,7 +129,7 @@ async fn dispatch_is_refused_when_the_remaining_budget_cannot_fit_an_observed_sudispatch.record_subagent_elapsed(std::time::Duration::from_secs(60));let mut options = SubagentRunOptions::default();options.run_context.dispatch = Some(dispatch);- let outcome = run_subagent(&definition, "task", options).await;+ let outcome = run_host_from_test_options(&definition, "task", options).await;assert!(matches!(@@ -153,7 +152,7 @@ async fn dispatch_is_not_refused_while_the_guard_has_no_evidence() {options.run_context.dispatch = Some(std::sync::Arc::new(crate::agent::tinyagents::host::TurnDispatchState::new(Some(std::time::Duration::ZERO)),));- let outcome = run_subagent(&definition, "task", options).await;+ let outcome = run_host_from_test_options(&definition, "task", options).await;assert!(matches!(outcome, Err(SubagentRunError::NoParentContext)),diff --git a/crates/openhuman-core/src/triage/escalation_model_tests.rs b/crates/openhuman-core/src/triage/escalation_model_tests.rsindex 65a6cc67cb..f5d8cb8180 100644--- a/crates/openhuman-core/src/triage/escalation_model_tests.rs+++ b/crates/openhuman-core/src/triage/escalation_model_tests.rs@@ -500,7 +500,7 @@ async fn escalate_dispatch_preserves_orchestrator_tools_without_child_delegation.iter().map(|tool| tool.name.as_str()).collect();- assert!(tool_names.contains(&"read_workspace_state"));+ assert!(tool_names.contains(&"file_read"));assert!(!tool_names.iter()