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(tinyagents): split deadline wind-down install into a testable helper
Steven Enamakelc133b3dd5a87
diff --git a/crates/openhuman-core/src/agent/tinyagents/deadline_wind_down.rs b/crates/openhuman-core/src/agent/tinyagents/deadline_wind_down.rsindex 7bb8b517e0..46018d88e4 100644--- a/crates/openhuman-core/src/agent/tinyagents/deadline_wind_down.rs+++ b/crates/openhuman-core/src/agent/tinyagents/deadline_wind_down.rs@@ -32,6 +32,7 @@ use tinyinference_llm::model::ModelResponse;use tinytools::ToolResult;use crate::agent::tinyagents::host::OpenHumanRunContext;+use crate::agent::tinyagents::observability::SubagentScope;use crate::agent::turn_deadline::TurnDeadline;/// Pauses the run once its turn deadline's wind-down point has passed.@@ -115,6 +116,21 @@ where/// ends at the hard stop. Detached children must not inherit the deadline of/// the turn that spawned them.pub(super) fn install(+ harness: &mut AgentHarness<(), OpenHumanRunContext>,+ handle: &Option<SteeringHandle>,+ run_context: &OpenHumanRunContext,+ subagent_scope: &Option<SubagentScope>,+) -> Option<Arc<DeadlineWindDownMiddleware>> {+ install_for(+ harness,+ handle.as_ref(),+ run_context.turn_deadline,+ subagent_scope.is_some(),+ )+}++/// [`install`] over plain values, for tests.+pub(super) fn install_for(harness: &mut AgentHarness<(), OpenHumanRunContext>,handle: Option<&SteeringHandle>,deadline: Option<TurnDeadline>,diff --git a/crates/openhuman-core/src/agent/tinyagents/deadline_wind_down_tests.rs b/crates/openhuman-core/src/agent/tinyagents/deadline_wind_down_tests.rsindex ce7f6beb55..4118af5d26 100644--- a/crates/openhuman-core/src/agent/tinyagents/deadline_wind_down_tests.rs+++ b/crates/openhuman-core/src/agent/tinyagents/deadline_wind_down_tests.rs@@ -57,7 +57,7 @@ fn install_clamps_the_policy_and_adds_the_middleware_for_a_root_turn() {let now = Instant::now();let deadline = TurnDeadline::new(now, Duration::from_secs(900));let h = handle();- let mw = install(&mut harness, Some(&h), Some(deadline), false);+ let mw = install_for(&mut harness, Some(&h), Some(deadline), false);assert!(mw.is_some());let clamped = harness.policy()@@ -82,12 +82,12 @@ fn install_leaves_children_and_unbounded_turns_alone() {let mut child: AgentHarness<(), OpenHumanRunContext> = AgentHarness::new();child.with_policy(crate::agent::tinyagents::run_policy_for(10, false));let before = child.policy().limits.max_wall_clock_ms;- assert!(install(&mut child, Some(&h), Some(deadline), true).is_none());+ assert!(install_for(&mut child, Some(&h), Some(deadline), true).is_none());assert_eq!(child.policy().limits.max_wall_clock_ms, before);let mut plain: AgentHarness<(), OpenHumanRunContext> = AgentHarness::new();plain.with_policy(crate::agent::tinyagents::run_policy_for(10, false));let before = plain.policy().limits.max_wall_clock_ms;- assert!(install(&mut plain, Some(&h), None, false).is_none());+ assert!(install_for(&mut plain, Some(&h), None, false).is_none());assert_eq!(plain.policy().limits.max_wall_clock_ms, before);}diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_runner.rs b/crates/openhuman-core/src/agent/tinyagents/turn_runner.rsindex 52ad06df32..80f18c57f3 100644--- a/crates/openhuman-core/src/agent/tinyagents/turn_runner.rs+++ b/crates/openhuman-core/src/agent/tinyagents/turn_runner.rs@@ -299,9 +299,7 @@ pub(super) async fn run_turn_via_tinyagents_body(run_context.tool_rules.clone(),);super::response_shape::install(&mut harness, hosted_root.is_some());- let is_child = subagent_scope.is_some(); // wind down before the web backstop:- super::deadline_wind_down::install(&mut harness, handle.as_ref(), run_context.turn_deadline, is_child);-+ super::deadline_wind_down::install(&mut harness, &handle, &run_context, &subagent_scope);// Fail-closed registry validation gate (issue #4249, Workstream 10 — registry).// The projected `CapabilityRegistry` produced these diagnostics during// assembly; enforce them here, *before* the first model dispatch, so an