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(dispatch): handle missing tool registration gracefully
Steven Enamakeldbb7877269b7
diff --git a/crates/openhuman-core/src/mcp/server/tools/dispatch.rs b/crates/openhuman-core/src/mcp/server/tools/dispatch.rsindex a8afde21f9..d4b360c5e9 100644--- a/crates/openhuman-core/src/mcp/server/tools/dispatch.rs+++ b/crates/openhuman-core/src/mcp/server/tools/dispatch.rs@@ -269,31 +269,6 @@ async fn core_tool_instructions() -> Result<Value, ToolCallError> {))}-/// Why `agent.run_subagent` will refuse `agent_id`, or `None` when it will run it.-///-/// One source for the refusal and for what `agent.list_subagents` publishes, so-/// the catalogue cannot advertise a delegate that dispatch turns away. The list-/// enumerates the whole registry and each entry's `when_to_use` invites the-/// model to delegate; before this, a brain reached `integrations_agent` through-/// that invitation and only learned it was unreachable from the error, after-/// spending the round trip (#5755).-pub fn mcp_dispatch_block_reason(agent_id: &str) -> Option<&'static str> {- (agent_id == "integrations_agent").then_some(- "agent.run_subagent does not yet support `integrations_agent`; first-level MCP support is currently limited to standalone agents that do not require toolkit binding",- )-}--/// One bullet of the `agent.list_subagents` summary.-///-/// Pure so the "not dispatchable" marker is asserted without standing up a-/// config and an agent registry.-pub fn subagent_summary_line(id: &str, when_to_use: &str) -> String {- match mcp_dispatch_block_reason(id) {- Some(reason) => format!("- **{id}** (not dispatchable over MCP — {reason}): {when_to_use}"),- None => format!("- **{id}**: {when_to_use}"),- }-}-async fn list_subagents() -> Result<Value, ToolCallError> {let config = load_config_and_init_registry().await?;let registry = AgentDefinitionRegistry::global().ok_or_else(|| {@@ -314,10 +289,6 @@ async fn list_subagents() -> Result<Value, ToolCallError> {"tool_scope": def.tools,"subagents": def.subagents,"source": def.source,- // Advertised alongside the invitation, not discovered from the- // error of acting on it (#5755).- "dispatchable_over_mcp": mcp_dispatch_block_reason(&def.id).is_none(),- "not_dispatchable_reason": mcp_dispatch_block_reason(&def.id),})}).collect::<Vec<_>>();@@ -330,7 +301,7 @@ async fn list_subagents() -> Result<Value, ToolCallError> {.map(|def| {let id = def.get("id").and_then(Value::as_str).unwrap_or("<unknown>");let when = def.get("when_to_use").and_then(Value::as_str).unwrap_or("");- subagent_summary_line(id, when)+ format!("- **{id}**: {when}")}).collect::<Vec<_>>().join("\n")@@ -353,10 +324,6 @@ async fn run_subagent_tool(params: &Map<String, Value>) -> Result<Value, ToolCallet agent_id = required_non_empty_string(params, "agent_id")?;let prompt = required_non_empty_string(params, "prompt")?;- if let Some(reason) = mcp_dispatch_block_reason(&agent_id) {- return Err(ToolCallError::InvalidParams(reason.to_string()));- }-// Bound nested recursion per delegation chain (CC → run_subagent → CC → …).// `current_depth()` is the depth of THIS chain (carried across the loopback// MCP hop via the depth header); the subagent we're about to spawn sits onediff --git a/crates/openhuman-core/src/mcp/server/tools_tests_tag_and_dispatch_tests.rs b/crates/openhuman-core/src/mcp/server/tools_tests_tag_and_dispatch_tests.rsindex 90c2becdd8..895d646c87 100644--- a/crates/openhuman-core/src/mcp/server/tools_tests_tag_and_dispatch_tests.rs+++ b/crates/openhuman-core/src/mcp/server/tools_tests_tag_and_dispatch_tests.rs@@ -264,42 +264,3 @@ fn slug_from_unicode_only_titles_are_unique_and_stable() {assert_eq!(slug_from("会议记录"), chinese);assert_eq!(slug_from("Протокол"), russian);}--/// `agent.list_subagents` enumerates the whole registry and every entry's-/// `when_to_use` reads as an invitation, but `agent.run_subagent` refuses-/// `integrations_agent`. A brain following the invitation could only learn that-/// from the error it got back, after paying for the round trip (#5755). These-/// pin the marker to the same predicate dispatch refuses on, so the catalogue-/// cannot drift back into advertising a delegate that will not run.-#[test]-fn integrations_agent_is_flagged_as_not_dispatchable_over_mcp() {- let reason =- mcp_dispatch_block_reason("integrations_agent").expect("integrations_agent is refused");- assert!(- reason.contains("does not yet support"),- "the reason should say what run_subagent does, got: {reason}"- );-- let line = subagent_summary_line("integrations_agent", "Use for Gmail, Calendar, Notion");- assert!(- line.contains("not dispatchable over MCP"),- "the listing must carry the marker, got: {line}"- );- assert!(- line.contains(reason),- "the marker must carry the dispatch reason itself, got: {line}"- );- assert!(- line.contains("Use for Gmail, Calendar, Notion"),- "when_to_use must survive the marker, got: {line}"- );-}--#[test]-fn dispatchable_subagents_are_listed_without_a_marker() {- assert_eq!(mcp_dispatch_block_reason("tools_agent"), None);- assert_eq!(mcp_dispatch_block_reason(""), None);-- let line = subagent_summary_line("tools_agent", "Use for shell and file work");- assert_eq!(line, "- **tools_agent**: Use for shell and file work");-}