Skip to content

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

fix(tinyagents): compute registry diagnostics before enforcing them

Steven Enamakele484e39e79a6
diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_exec.rs b/crates/openhuman-core/src/agent/tinyagents/turn_exec.rs
index 076d07a49e..03af9485e9 100644
--- a/crates/openhuman-core/src/agent/tinyagents/turn_exec.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/turn_exec.rs
@@ -24,6 +24,7 @@ use crate::agent::harness::tool_result_artifacts::TINYAGENTS_TOOL_RESULT_ARTIFAC
use crate::agent::tinyagents::host::OpenHumanRunContext;
use crate::agent::tinyagents::middleware::TurnContextMiddleware;
use crate::agent::tinyagents::observability::{OpenhumanEventBridge, SubagentScope};
+use crate::agent::tinyagents::tool_registration::capability_diagnostics;
use crate::agent::tinyagents::turn_middleware::{
install_turn_middleware, TurnMiddlewareInputs, TurnWiring,
};
@@ -282,12 +283,14 @@ async fn run_turn_via_tinyagents_body(
..
} = turn_models;
let plan_models = turn_models_for_plan(
- model,
- primary,
- tier_routes,
- &error_slot,
- hosted_security_gate,
- ),
+ model,
+ primary,
+ tier_routes,
+ &error_slot,
+ hosted_security_gate,
+ );
+ let planner = OpenHumanTurnPlanner {
+ models: plan_models.clone(),
policy,
tool_sets: tool_sets.clone(),
allowed: allowed.clone(),
@@ -587,6 +590,11 @@ async fn run_turn_via_tinyagents_body(
// an ambiguous/broken tool surface (duplicate name across native/MCP/Composio/
// generated tools, dangling alias, etc.) aborts the turn instead of silently
// resolving to an unintended component while a provider call is in flight.
+ let registry_diagnostics = capability_diagnostics(
+ &plan_models,
+ &bridge_tool_sets,
+ &prepared.tools().plan.admitted,
+ );
if let Err(error) = enforce_registry_diagnostics(&registry_diagnostics) {
// Settle the driver's steering registration before the turn aborts.
let _ = prepared.split().1.finish(None);
diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_plan_tests.rs b/crates/openhuman-core/src/agent/tinyagents/turn_plan_tests.rs
index 62a313e563..eadbfede96 100644
--- a/crates/openhuman-core/src/agent/tinyagents/turn_plan_tests.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/turn_plan_tests.rs
@@ -89,9 +89,7 @@ async fn prepare_with(
tool_sets,
allowed: None,
has_thread,
- is_subagent: false,
session_deferred: Arc::new(HashSet::new()),
- diagnostics: Arc::default(),
};
let request = DriverRequest {
history: vec![tinyinference_llm::message::Message::user("hi")],