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
fix(agent): give the scout catalogue the parent's own advertised specs\n\nReview follow-up for #6162 (CodeRabbit, on the durable-spec change).\n\n`AgentPrepareContextTool::render_parent_tool_catalog` rendered the\nparent's tool catalogue from `ParentExecutionContext::all_tool_specs`,\nwhich the previous commit made durable-only. That list describes what a\nchild may inherit and deliberately carries none of the parent's\nsynthesised `delegate_*` tools — so the scout could no longer recommend\na delegation the parent can execute, which is most of what it is for.\n\n- `ParentExecutionContext::visible_tool_specs`: the specs behind\n `visible_tool_names` — the parent's provider-facing list this turn,\n policy-filtered, de-duplicated, delegates included. Both builders fill\n it (`Agent::visible_tool_specs_arc` on the root-context path).\n- The catalogue reads it, falling back to the name-filtered\n `all_tool_specs` for a context that does not carry the list.\n- `all_tool_specs` stays durable-only and index-aligned with `all_tools`\n for child construction.\n- Regression tests: a parent whose inheritable registry lacks the\n delegate but whose advertised surface carries it renders the delegate\n line; a context without the visible list keeps the old fallback.\n
Shanu4c045d240c60
diff --git a/src/openhuman/agent/harness/fork_context.rs b/src/openhuman/agent/harness/fork_context.rsindex c0ce14e190..6663e98e58 100644--- a/src/openhuman/agent/harness/fork_context.rs+++ b/src/openhuman/agent/harness/fork_context.rs@@ -61,6 +61,15 @@ pub struct ParentExecutionContext {/// this role-specific surface.pub visible_tool_names: std::collections::HashSet<String>,+ /// The specs behind [`Self::visible_tool_names`]: the parent's own+ /// provider-facing list this turn — policy-filtered, de-duplicated, and+ /// including its synthesised `delegate_*` tools. For consumers that+ /// describe what the *parent* can call (the scout's catalogue), never for+ /// building a child's tool set — that is [`Self::all_tools`] ++ /// [`Self::all_tool_specs`], which carry no delegate. Empty when the+ /// builder does not know the parent's surface.+ pub visible_tool_specs: Arc<Vec<ToolSpec>>,+/// Explicit profile/channel ceiling inherited by child agents. This is not/// the parent's role-specific visible surface: an orchestrator may delegate/// file writes to a code specialist without advertising `file_write`diff --git a/src/openhuman/agent/harness/session/runtime_impl_01_part_01.rs b/src/openhuman/agent/harness/session/runtime_impl_01_part_01.rsindex 6bb4a1661c..dfb80caee4 100644--- a/src/openhuman/agent/harness/session/runtime_impl_01_part_01.rs+++ b/src/openhuman/agent/harness/session/runtime_impl_01_part_01.rs@@ -97,6 +97,12 @@ impl Agent {Arc::clone(&self.tool_specs)}+ /// Clone the agent's provider-facing spec list: visible, policy-allowed,+ /// de-duplicated, synthesised delegates included.+ pub fn visible_tool_specs_arc(&self) -> Arc<Vec<ToolSpec>> {+ Arc::clone(&self.visible_tool_specs)+ }+/// Clone the specs of the durable registry alone, index for index with/// [`Self::tools_arc`] — the pair a sub-agent is handed, so a child never/// sees a spec for a synthesised delegate it holds no instance for.diff --git a/src/openhuman/agent/harness/session/turn/tools.rs b/src/openhuman/agent/harness/session/turn/tools.rsindex fffe05bf60..ae16d7e79b 100644--- a/src/openhuman/agent/harness/session/turn/tools.rs+++ b/src/openhuman/agent/harness/session/turn/tools.rs@@ -77,6 +77,7 @@ impl Agent {.iter().map(|spec| spec.name.clone()).collect(),+ visible_tool_specs: Arc::clone(&self.visible_tool_specs),subagent_tool_ceiling_names: self.subagent_tool_ceiling_names.clone(),model_name: self.model_name.clone(),temperature: self.temperature,diff --git a/src/openhuman/agent/harness/subagent_runner/ops_tests.rs b/src/openhuman/agent/harness/subagent_runner/ops_tests.rsindex 96e8d7f41d..0afcc67ff7 100644--- a/src/openhuman/agent/harness/subagent_runner/ops_tests.rs+++ b/src/openhuman/agent/harness/subagent_runner/ops_tests.rs@@ -253,6 +253,7 @@ fn make_parent(),all_tools: Arc::new(tools),all_tool_specs: Arc::new(tool_specs),+ visible_tool_specs: Arc::new(Vec::new()),visible_tool_names: std::collections::HashSet::new(),subagent_tool_ceiling_names: std::collections::HashSet::new(),model_name: "test-model".into(),diff --git a/src/openhuman/agent/orchestration/agent_teams/runtime_tests.rs b/src/openhuman/agent/orchestration/agent_teams/runtime_tests.rsindex c9210db6bb..f8142d6bc6 100644--- a/src/openhuman/agent/orchestration/agent_teams/runtime_tests.rs+++ b/src/openhuman/agent/orchestration/agent_teams/runtime_tests.rs@@ -115,6 +115,7 @@ fn mock_parent(model: Arc<dyn ChatModel<()>>) -> ParentExecutionContext {turn_model_source: crate::openhuman::agent::tinyagents::TurnModelSource::from_model(model),all_tools: Arc::new(Vec::<Box<dyn Tool>>::new()),all_tool_specs: Arc::new(Vec::<ToolSpec>::new()),+ visible_tool_specs: Arc::new(Vec::new()),visible_tool_names: std::collections::HashSet::new(),subagent_tool_ceiling_names: std::collections::HashSet::new(),model_name: "test-model".to_string(),diff --git a/src/openhuman/agent/orchestration/ops_tests.rs b/src/openhuman/agent/orchestration/ops_tests.rsindex a949bc2e16..e5fb2b76c3 100644--- a/src/openhuman/agent/orchestration/ops_tests.rs+++ b/src/openhuman/agent/orchestration/ops_tests.rs@@ -89,6 +89,7 @@ fn parent_context(model: Arc<dyn ChatModel<()>>) -> ParentExecutionContext {),all_tools: Arc::new(Vec::<Box<dyn Tool>>::new()),all_tool_specs: Arc::new(Vec::<ToolSpec>::new()),+ visible_tool_specs: Arc::new(Vec::new()),visible_tool_names: std::collections::HashSet::new(),subagent_tool_ceiling_names: std::collections::HashSet::new(),model_name: "test-model".to_string(),diff --git a/src/openhuman/agent/orchestration/parent_context/builder.rs b/src/openhuman/agent/orchestration/parent_context/builder.rsindex 6bf5f35aef..9cc8c80fd4 100644--- a/src/openhuman/agent/orchestration/parent_context/builder.rs+++ b/src/openhuman/agent/orchestration/parent_context/builder.rs@@ -99,6 +99,9 @@ pub(crate) async fn build_root_parent(// No visibility filter for this spawned/background builder — empty means// "unknown" and callers fall back to the full registry (see field doc).visible_tool_names: HashSet::new(),+ // The agent's advertised surface, delegates included, for consumers+ // that describe what this parent can call.+ visible_tool_specs: agent.visible_tool_specs_arc(),subagent_tool_ceiling_names: HashSet::new(),model_name: agent.model_name().to_string(),temperature: agent.temperature(),diff --git a/src/openhuman/agent/orchestration/tools/agent_prepare_context_part_01.rs b/src/openhuman/agent/orchestration/tools/agent_prepare_context_part_01.rsindex 0933fc9337..d6df199ef9 100644--- a/src/openhuman/agent/orchestration/tools/agent_prepare_context_part_01.rs+++ b/src/openhuman/agent/orchestration/tools/agent_prepare_context_part_01.rs@@ -572,16 +572,25 @@ impl AgentPrepareContextTool {/// advertises and will execute this turn), not the full registry —/// otherwise the scout could recommend hidden direct-exec/spawn tools/// the parent can't call, which the runtime would reject or which would- /// bypass specialist routing. Falls back to the full registry only when- /// the visible set is unknown (empty), to preserve behaviour in contexts- /// that don't populate it.+ /// bypass specialist routing. Read from `visible_tool_specs`, the parent's+ /// own advertised list, because `all_tool_specs` describes what a *child*+ /// may inherit and deliberately carries none of the parent's synthesised+ /// `delegate_*` tools — the very tools the scout most often recommends.+ /// Falls back to that registry, name-filtered, when a context does not+ /// carry the visible list, to preserve behaviour for builders that don't+ /// populate it.fn render_parent_tool_catalog() -> String {let Some(parent) = current_parent() else {return String::new();};let visible = &parent.visible_tool_names;+ let specs: &[crate::openhuman::tools::ToolSpec] = if parent.visible_tool_specs.is_empty() {+ &parent.all_tool_specs+ } else {+ &parent.visible_tool_specs+ };let mut out = String::with_capacity(2048);- for spec in parent.all_tool_specs.iter() {+ for spec in specs.iter() {if spec.name == "agent_prepare_context" {continue;}diff --git a/src/openhuman/agent/orchestration/tools/agent_prepare_context_tests.rs b/src/openhuman/agent/orchestration/tools/agent_prepare_context_tests.rsindex 7013ba8931..f628dfef37 100644--- a/src/openhuman/agent/orchestration/tools/agent_prepare_context_tests.rs+++ b/src/openhuman/agent/orchestration/tools/agent_prepare_context_tests.rs@@ -319,3 +319,124 @@ fn credits_exhausted_scout_failure_does_not_reach_sentry() {);assert_eq!(events[0].level, sentry::Level::Error);}++// ─────────────────────────────────────────────────────────────────────────────+// Parent tool catalogue: rendered from the parent's own advertised surface+// ─────────────────────────────────────────────────────────────────────────────++/// A spec with the given name and description; the schema is irrelevant here.+fn catalog_spec(name: &str, description: &str) -> crate::openhuman::tools::ToolSpec {+ crate::openhuman::tools::ToolSpec {+ name: name.to_string(),+ description: description.to_string(),+ parameters: serde_json::json!({"type": "object"}),+ }+}++/// A parent context whose inheritable registry (`all_tool_specs`) and own+/// advertised surface (`visible_tool_specs`) are chosen by the caller.+/// `visible_tool_names` is derived from the visible specs, as the turn+/// builder derives it.+fn parent_context_with_specs(+ all_tool_specs: Vec<crate::openhuman::tools::ToolSpec>,+ visible_tool_specs: Vec<crate::openhuman::tools::ToolSpec>,+) -> crate::openhuman::agent::harness::fork_context::ParentExecutionContext {+ use std::sync::Arc;+ // The embedding seam fails loudly when unwired; `create_memory` reaches it.+ crate::openhuman::memory::host_impls::install_for_tests();+ let workspace = tempfile::TempDir::new().expect("temp workspace");+ let workspace_dir = workspace.path().to_path_buf();+ std::mem::forget(workspace);+ let memory_cfg = crate::openhuman::config::MemoryConfig {+ backend: "none".into(),+ ..crate::openhuman::config::MemoryConfig::default()+ };+ let memory: Arc<dyn crate::openhuman::memory::Memory> =+ Arc::from(tinymemory_core::store::create_memory(&memory_cfg, &workspace_dir).unwrap());+ let model: Arc<dyn tinyinference::model::ChatModel<()>> =+ Arc::new(tinyagents_harness::testkit::ScriptedModel::new(Vec::new()));+ crate::openhuman::agent::harness::fork_context::ParentExecutionContext {+ workspace_descriptor: None,+ agent_definition_id: "orchestrator".into(),+ allowed_subagent_ids: std::collections::HashSet::new(),+ turn_model_source: crate::openhuman::agent::tinyagents::TurnModelSource::from_model(model),+ all_tools: Arc::new(Vec::new()),+ all_tool_specs: Arc::new(all_tool_specs),+ visible_tool_names: visible_tool_specs+ .iter()+ .map(|spec| spec.name.clone())+ .collect(),+ visible_tool_specs: Arc::new(visible_tool_specs),+ subagent_tool_ceiling_names: std::collections::HashSet::new(),+ model_name: "test-model".into(),+ temperature: 0.0,+ workspace_dir,+ memory,+ agent_config: crate::openhuman::config::AgentConfig::default(),+ workflows: Arc::new(Vec::new()),+ memory_context: Arc::new(None),+ session_id: "parent-session".into(),+ channel: "test".into(),+ connected_integrations: Vec::new(),+ tool_call_format: crate::openhuman::agent::context::prompt::ToolCallFormat::Native,+ session_key: "parent-key".into(),+ session_parent_prefix: None,+ on_progress: None,+ run_queue: None,+ }+}++/// The catalogue describes the parent's own advertised surface, which includes+/// its synthesised `delegate_*` tools — not `all_tool_specs`, which is what a+/// child may inherit and deliberately carries no delegate (#4452). The scout+/// exists to recommend exactly those delegates back to the parent.+#[tokio::test]+async fn catalog_lists_the_parents_synthesised_delegates_from_its_visible_specs() {+ let ctx = parent_context_with_specs(+ vec![+ catalog_spec("echo", "durable"),+ catalog_spec("agent_prepare_context", "this tool"),+ ],+ vec![+ catalog_spec("echo", "durable"),+ catalog_spec(+ "delegate_to_integrations_agent",+ "route to a connected integration",+ ),+ catalog_spec("agent_prepare_context", "this tool"),+ ],+ );+ let catalog = crate::openhuman::agent::harness::fork_context::with_parent_context(ctx, async {+ AgentPrepareContextTool::render_parent_tool_catalog()+ })+ .await;+ assert!(+ catalog.contains("- delegate_to_integrations_agent: route to a connected integration\n"),+ "the parent's delegate must be recommendable: {catalog:?}"+ );+ assert!(catalog.contains("- echo: durable\n"));+ assert!(+ !catalog.contains("agent_prepare_context"),+ "the scout must not recommend another scout pass"+ );+}++/// A context without a visible spec list (background builders, older+/// callers) keeps the previous behaviour: the inheritable registry, filtered+/// by the visible names.+#[tokio::test]+async fn catalog_falls_back_to_all_tool_specs_when_visible_specs_are_absent() {+ let mut ctx = parent_context_with_specs(+ vec![+ catalog_spec("echo", "durable"),+ catalog_spec("hidden", "not advertised"),+ ],+ Vec::new(),+ );+ ctx.visible_tool_names = std::iter::once("echo".to_string()).collect();+ let catalog = crate::openhuman::agent::harness::fork_context::with_parent_context(ctx, async {+ AgentPrepareContextTool::render_parent_tool_catalog()+ })+ .await;+ assert_eq!(catalog, "- echo: durable\n");+}diff --git a/src/openhuman/agent/orchestration/tools/close_subagent_tests.rs b/src/openhuman/agent/orchestration/tools/close_subagent_tests.rsindex a75e9ac19c..2db6c7348c 100644--- a/src/openhuman/agent/orchestration/tools/close_subagent_tests.rs+++ b/src/openhuman/agent/orchestration/tools/close_subagent_tests.rs@@ -111,6 +111,7 @@ fn parent_context(workspace_dir: &Path) -> ParentExecutionContext {turn_model_source: crate::openhuman::agent::tinyagents::TurnModelSource::from_model(model),all_tools: Arc::new(Vec::new()),all_tool_specs: Arc::new(Vec::new()),+ visible_tool_specs: Arc::new(Vec::new()),visible_tool_names: std::collections::HashSet::new(),subagent_tool_ceiling_names: std::collections::HashSet::new(),model_name: "test-model".into(),diff --git a/src/openhuman/agent/orchestration/tools/spawn_async_subagent_tests.rs b/src/openhuman/agent/orchestration/tools/spawn_async_subagent_tests.rsindex c4209fa79c..961c09bd70 100644--- a/src/openhuman/agent/orchestration/tools/spawn_async_subagent_tests.rs+++ b/src/openhuman/agent/orchestration/tools/spawn_async_subagent_tests.rs@@ -326,6 +326,7 @@ fn parent_context(workspace_dir: &Path) -> ParentExecutionContext {),all_tools: Arc::new(Vec::new()),all_tool_specs: Arc::new(Vec::new()),+ visible_tool_specs: Arc::new(Vec::new()),visible_tool_names: std::collections::HashSet::new(),subagent_tool_ceiling_names: std::collections::HashSet::new(),model_name: "test-model".into(),diff --git a/src/openhuman/agent/orchestration/tools/spawn_parallel_agents_tests.rs b/src/openhuman/agent/orchestration/tools/spawn_parallel_agents_tests.rsindex 50ba80073d..526fbeb482 100644--- a/src/openhuman/agent/orchestration/tools/spawn_parallel_agents_tests.rs+++ b/src/openhuman/agent/orchestration/tools/spawn_parallel_agents_tests.rs@@ -124,6 +124,7 @@ fn parent_context(max_parallel_tools: usize) -> ParentExecutionContext {turn_model_source: crate::openhuman::agent::tinyagents::TurnModelSource::from_model(model),all_tools: Arc::new(Vec::new()),all_tool_specs: Arc::new(Vec::new()),+ visible_tool_specs: Arc::new(Vec::new()),visible_tool_names: std::collections::HashSet::new(),subagent_tool_ceiling_names: std::collections::HashSet::new(),model_name: "test-model".into(),diff --git a/src/openhuman/agent/orchestration/tools/spawn_worker_thread_tests.rs b/src/openhuman/agent/orchestration/tools/spawn_worker_thread_tests.rsindex 38aa01a7de..597f370f73 100644--- a/src/openhuman/agent/orchestration/tools/spawn_worker_thread_tests.rs+++ b/src/openhuman/agent/orchestration/tools/spawn_worker_thread_tests.rs@@ -81,6 +81,7 @@ fn test_parent_ctx(workspace_dir: PathBuf) -> ParentExecutionContext {channel: "test".into(),all_tools: Arc::new(vec![]),all_tool_specs: Arc::new(vec![]),+ visible_tool_specs: Arc::new(Vec::new()),visible_tool_names: std::collections::HashSet::new(),subagent_tool_ceiling_names: std::collections::HashSet::new(),workflows: Arc::new(vec![]),diff --git a/src/openhuman/agent/orchestration/tools/tools_e2e_tests.rs b/src/openhuman/agent/orchestration/tools/tools_e2e_tests.rsindex f34aa1e156..69edf2bb74 100644--- a/src/openhuman/agent/orchestration/tools/tools_e2e_tests.rs+++ b/src/openhuman/agent/orchestration/tools/tools_e2e_tests.rs@@ -456,6 +456,7 @@ fn parent_context(turn_model_source: crate::openhuman::agent::tinyagents::TurnModelSource::from_model(model),all_tools: Arc::new(Vec::new()),all_tool_specs: Arc::new(Vec::new()),+ visible_tool_specs: Arc::new(Vec::new()),visible_tool_names: std::collections::HashSet::new(),subagent_tool_ceiling_names: std::collections::HashSet::new(),model_name: "test-model".into(),diff --git a/src/openhuman/agent/orchestration/workflow_runs/engine_tests.rs b/src/openhuman/agent/orchestration/workflow_runs/engine_tests.rsindex 5859fe282a..3fba51bc99 100644--- a/src/openhuman/agent/orchestration/workflow_runs/engine_tests.rs+++ b/src/openhuman/agent/orchestration/workflow_runs/engine_tests.rs@@ -177,6 +177,7 @@ fn mock_parent(model: Arc<dyn ChatModel<()>>) -> ParentExecutionContext {),all_tools: Arc::new(Vec::<Box<dyn Tool>>::new()),all_tool_specs: Arc::new(Vec::<ToolSpec>::new()),+ visible_tool_specs: Arc::new(Vec::new()),visible_tool_names: std::collections::HashSet::new(),subagent_tool_ceiling_names: std::collections::HashSet::new(),model_name: "test-model".to_string(),