Skip to content

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

fix(flows): run workflow graph loading on the blocking pool

Steven Enamakelf260b2b1bc8e
diff --git a/crates/openhuman-core/src/flows/authoring_host.rs b/crates/openhuman-core/src/flows/authoring_host.rs
index 07df84d989..ac143ff502 100644
--- a/crates/openhuman-core/src/flows/authoring_host.rs
+++ b/crates/openhuman-core/src/flows/authoring_host.rs
@@ -48,9 +48,13 @@ impl Callbacks {
impl Callbacks {
async fn resolve_workflow(&self, workflow_id: String) -> BusResult<Option<Value>> {
let config = Arc::clone(&self.config);
+ let context = self.context.clone();
self.in_context(async move {
- ops::load_flow_graph(&config, &workflow_id)
- .map(|graph| graph.map(|graph| serde_json::to_value(graph).expect("graph serializes")))
+ let graph = context
+ .spawn_blocking(move || ops::load_flow_graph(&config, &workflow_id))
+ .await
+ .map_err(|error| format!("workflow resolver task failed: {error}"))??;
+ Ok(graph.map(|graph| serde_json::to_value(graph).expect("graph serializes")))
})
.await
.map_err(|error| tinybus::Error::failed(error))
diff --git a/crates/openhuman-core/src/flows/host_gates/mod_tests.rs b/crates/openhuman-core/src/flows/host_gates/mod_tests.rs
index 1f86e70b8e..452015a002 100644
--- a/crates/openhuman-core/src/flows/host_gates/mod_tests.rs
+++ b/crates/openhuman-core/src/flows/host_gates/mod_tests.rs
@@ -42,6 +42,26 @@ fn seeded_slack_send_contract() -> ToolContract {
}
}
+fn seeded_slack_send_message_contract_with_schema() -> ToolContract {
+ ToolContract {
+ slug: "SLACKARGNAMETEST_SEND_MESSAGE".to_string(),
+ toolkit: "slackargnametest".to_string(),
+ description: None,
+ required_args: vec![],
+ input_schema: Some(json!({
+ "type": "object",
+ "properties": {
+ "channel": { "type": "string" },
+ "markdown_text": { "type": "string" }
+ }
+ })),
+ output_fields: vec![],
+ output_schema: None,
+ primary_array_path: None,
+ is_curated: false,
+ }
+}
+
fn ws3_flow_conn(toolkit: &str, id: &str) -> FlowConnection {
FlowConnection {
connection_ref: format!("composio:{toolkit}:{id}"),
diff --git a/crates/openhuman-core/src/flows/host_gates/tool_contracts.rs b/crates/openhuman-core/src/flows/host_gates/tool_contracts.rs
index f9a88254e3..e8bf1a4d37 100644
--- a/crates/openhuman-core/src/flows/host_gates/tool_contracts.rs
+++ b/crates/openhuman-core/src/flows/host_gates/tool_contracts.rs
@@ -40,13 +40,7 @@ use tinyflows::model::{NodeKind, WorkflowGraph};
/// (Part 2c/2d) — those degrade gracefully because a binding to an unknown
/// field can't be proven wrong, whereas a nonexistent slug or a missing
/// required arg are both provably broken.
-/// Whether OpenHuman ships a STATIC curated catalog for `toolkit`. This is the
-/// exact condition both [`validate_tool_contracts`]'s curation gate and
-/// `tinyflows::caps::flow_tool_allowed`'s runtime Path A use to decide a toolkit
-/// is a hard curated-only allowlist: for such a toolkit a real-but-uncurated
-/// action is rejected on EVERY real run, so the author-time gate and the early
-/// builder-tool warnings (`get_tool_contract` / `search_tool_catalog`) must all
-/// agree on it — one home for the check so they cannot drift.
+/// Enforces the host's curated-only, live-action and argument-shape policy.
pub(crate) async fn validate_tool_contracts(config: &Config, graph: &WorkflowGraph) -> Vec<String> {
use crate::integrations::composio::contract::validation::{
validate_tool_contract_nodes, ToolContractNode,