Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

test(tinyagents): cover control alias resolution from execution parent

Steven Enamakelfc867abbbf32
diff --git a/crates/openhuman-core/src/agent/tinyagents/tool_registration_tests.rs b/crates/openhuman-core/src/agent/tinyagents/tool_registration_tests.rs
index 745b580566..2ca6d842e8 100644
--- a/crates/openhuman-core/src/agent/tinyagents/tool_registration_tests.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/tool_registration_tests.rs
@@ -68,6 +68,103 @@ fn threaded_turn_keeps_goal_tools_as_exposure_candidates() {
}
}
+#[tokio::test]
+async fn static_live_harness_builder_resolves_control_aliases_from_the_execution_parent() {
+ use crate::agent::harness::fork_context::ParentExecutionContext;
+ use crate::agent::orchestration::subagent_sessions::{
+ DurableSubagentSession, DurableSubagentStatus, SubagentSessionStore,
+ };
+ use tinyagents_harness::{context::RunConfig, tool::ToolDispatch, CallId};
+
+ let workspace = tempfile::tempdir().expect("live harness workspace");
+ let config = crate::config::Config::default();
+ let core = crate::core::runtime::CoreContext::for_test_with_config(
+ crate::core::runtime::DomainSet::full(),
+ config,
+ );
+ let model: Arc<dyn tinyinference_llm::model::ChatModel<()>> =
+ Arc::new(tinyagents_harness::testkit::ScriptedModel::new(Vec::new()));
+ let parent = ParentExecutionContext {
+ agent_definition_id: "live-orchestrator".into(),
+ allowed_subagent_ids: HashSet::new(),
+ turn_model_source: crate::agent::tinyagents::TurnModelSource::from_model(model),
+ all_tools: Arc::new(Vec::new()),
+ all_tool_specs: Arc::new(Vec::new()),
+ visible_tool_names: HashSet::new(),
+ visible_tool_specs: Arc::new(Vec::new()),
+ subagent_tool_ceiling_names: HashSet::new(),
+ model_name: "test-model".into(),
+ temperature: 0.0,
+ workspace_dir: workspace.path().to_path_buf(),
+ workspace_descriptor: None,
+ agent_config: Default::default(),
+ workflows: Arc::new(Vec::new()),
+ memory_context: Arc::new(None),
+ session_id: "live-parent-session".into(),
+ channel: "voice-live-test".into(),
+ connected_integrations: Vec::new(),
+ tool_call_format: tinytools_agent::dialect::ToolCallFormat::Native,
+ session_key: "live-parent-session".into(),
+ session_parent_prefix: None,
+ on_progress: None,
+ run_queue: None,
+ host_env: Default::default(),
+ };
+ let store = SubagentSessionStore::new(workspace.path().to_path_buf());
+ store
+ .save(&[DurableSubagentSession {
+ subagent_session_id: "live-owned-session".into(),
+ parent_session: "live-parent-session".into(),
+ parent_thread_id: Some("voice-thread".into()),
+ worker_thread_id: None,
+ agent_id: "researcher".into(),
+ display_name: None,
+ model: None,
+ sandbox_mode: "workspace".into(),
+ action_root: None,
+ task_key: "research".into(),
+ task_title: "Research task".into(),
+ current_task_id: Some("live-task".into()),
+ lifecycle_key: None,
+ status: DurableSubagentStatus::Idle,
+ reusable: true,
+ latest_history: None,
+ latest_error: None,
+ created_at: "2026-01-01T00:00:00Z".into(),
+ updated_at: "2026-01-01T00:00:00Z".into(),
+ last_used_at: "2026-01-01T00:00:00Z".into(),
+ }])
+ .expect("seed one scoped durable row");
+
+ let tools: SharedToolSet = Arc::new(vec![Box::new(
+ crate::agent::orchestration::tools::ListSubagentsTool::new(),
+ )]);
+ let sets = vec![tools];
+ let mut harness: AgentHarness<(), OpenHumanRunContext> = AgentHarness::new();
+ host_tool_set_builder(&sets, &None, true, &HashSet::new()).register(&mut harness, None);
+ let dispatch = harness
+ .tools()
+ .dispatch("list_subagents")
+ .expect("static builder registered the control surface");
+ let run = OpenHumanRunContext::new()
+ .with_core(Some(Arc::clone(&core)))
+ .with_parent(parent)
+ .into_tinyagents(RunConfig::new("live-harness-parent").with_thread("voice-thread"));
+
+ let result = dispatch
+ .execute(
+ &(),
+ CallId::new("live-list-call"),
+ serde_json::json!({}),
+ ToolCallOptions::default(),
+ &run,
+ )
+ .await
+ .expect("the live control resolves its execution parent");
+ assert!(!result.is_error, "{}", result.output());
+ assert!(result.output().contains("live-owned-session"));
+}
+
#[tokio::test]
async fn registered_memory_dispatch_enforces_one_budget_across_distinct_calls() {
use crate::memory::test_fixtures::{bind_reference, config_in};