Skip to content

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

fix(flows): await async node contract loading in copilot bus

Steven Enamakel785c0a1e6cb2
diff --git a/crates/openhuman-core/src/flows/copilot_bus.rs b/crates/openhuman-core/src/flows/copilot_bus.rs
index 53a704009c..02d7eee8e4 100644
--- a/crates/openhuman-core/src/flows/copilot_bus.rs
+++ b/crates/openhuman-core/src/flows/copilot_bus.rs
@@ -32,12 +32,18 @@ pub(crate) struct CopilotToolCatalog {
impl CopilotToolCatalog {
/// Load the tools the compiled module serves for this host configuration.
pub(crate) fn load(config: Arc<Config>) -> Result<Self, String> {
- // Tool registration is synchronous, so this metadata-only call uses
- // the storage blocking bridge. It carries the supplied Config
- // explicitly and does not make a host callback or resolve tenant data;
- // actual tool calls below take their authority from ToolRunContext.
- let node_kinds = serde_json::to_value(crate::flows::all_node_kind_contracts())
- .map_err(|error| format!("could not encode workflow node contracts: {error}"))?
+ // Tool registration is synchronous, so fetch module-owned metadata
+ // through the storage blocking bridge. This call carries the supplied
+ // config and resolves no tenant data; tool calls take their authority
+ // from ToolRunContext.
+ let call_config = Arc::clone(&config);
+ let node_kinds = crate::storage::block_on_anyhow(async move {
+ crate::flows::all_node_kind_contracts(&call_config)
+ .await
+ .map_err(anyhow::Error::msg)
+ })
+ .map_err(|error| format!("could not load workflow node contracts: {error}"))
+ .and_then(|contracts| serde_json::to_value(contracts).map_err(|error| error.to_string()))?
.as_array()
.cloned()
.ok_or_else(|| "workflow node contracts were not an array".to_string())?;