Skip to content

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

fix(tools): use config-aware registry entries for diagnostics\n\nThe `diagnostics_for_config` function was calling `registry_entries()` which reads connected-client tools from the process default workspace, but it should use `registry_entries_for_config(config)` to respect the provided configuration. This change adds a new function that accepts a config parameter and refactors the existing one to delegate to a shared implementation, ensuring diagnostics correctly reflect the tools available in the specified workspace rather than the ambient process default.\n\nAuto-committed-on: dragonfly\n

Steven Enamakel9d56c3eb0dd9
diff --git a/src/openhuman/tools/registry/ops.rs b/src/openhuman/tools/registry/ops.rs
index 1a839973fd..ce8263861b 100644
--- a/src/openhuman/tools/registry/ops.rs
+++ b/src/openhuman/tools/registry/ops.rs
@@ -51,7 +51,7 @@ pub async fn diagnostics() -> Result<RpcOutcome<ToolPolicyDiagnostics>, String>
pub fn diagnostics_for_config(config: &Config) -> RpcOutcome<ToolPolicyDiagnostics> {
log::debug!("[tool_registry] diagnostics_for_config start");
- let tools = registry_entries();
+ let tools = registry_entries_for_config(config);
let total_tools = tools.len();
let enabled_tools = tools.iter().filter(|entry| entry.enabled).count();
let mcp_stdio_tools = tools
@@ -220,7 +220,30 @@ pub fn get_tool(tool_id: &str) -> Result<RpcOutcome<ToolRegistryEntry>, String>
/// 1. MCP stdio server tools (existing `mcp::server` surface)
/// 2. Controller-backed tools (existing `tools` namespace)
/// 3. Connected MCP client server tools (new `mcp_clients` domain)
+///
+/// The connected-client tools come from whichever workspace `mcp::init` claimed
+/// as the process default. That is right for the shipped app, which opens one;
+/// a caller that holds a `Config` should prefer
+/// [`registry_entries_for_config`], which names the workspace it means.
pub fn registry_entries() -> Vec<ToolRegistryEntry> {
+ build_registry_entries(None)
+}
+
+/// The same snapshot, with connected-client tools read from `config`'s
+/// workspace rather than the process default.
+///
+/// The two differ only when more than one workspace is open in a process.
+/// `mcp::host::resolve` returns a lone host but `None` once a second exists, so
+/// the ambient form silently reports nothing connected in a test binary where
+/// several cases each open their own temporary workspace — which is how
+/// `tool_registry_entries_include_connected_mcp_client_tools` came to pass
+/// alone and fail beside its neighbours.
+pub fn registry_entries_for_config(config: &Config) -> Vec<ToolRegistryEntry> {
+ build_registry_entries(Some(config))
+}
+
+/// The shared body. `config` selects the MCP host; everything else is identical.
+fn build_registry_entries(config: Option<&Config>) -> Vec<ToolRegistryEntry> {
let mut entries = BTreeMap::new();
for spec in crate::openhuman::mcp::server::tool_specs() {
@@ -245,7 +268,14 @@ pub fn registry_entries() -> Vec<ToolRegistryEntry> {
// (kind = CurrentThread) panics on block_in_place.
if handle.runtime_flavor() == tokio::runtime::RuntimeFlavor::MultiThread {
tokio::task::block_in_place(|| {
- handle.block_on(connections::all_connected_tools())
+ handle.block_on(async {
+ match config {
+ Some(config) => {
+ connections::all_connected_tools_for_config(config).await
+ }
+ None => connections::all_connected_tools().await,
+ }
+ })
})
} else {
Vec::new()