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
refactor(flows): route graph migration and validation through the bus
Steven Enamakel208182d1d76b
diff --git a/crates/openhuman-core/src/flows/ops.rs b/crates/openhuman-core/src/flows/ops.rsindex 0b017bb5b7..66d98f353a 100644--- a/crates/openhuman-core/src/flows/ops.rs+++ b/crates/openhuman-core/src/flows/ops.rs@@ -36,7 +36,6 @@ use std::sync::{Arc, LazyLock};use serde_json::{json, Value};use tinyflows::model::{NodeKind, TriggerKind, WorkflowGraph};-use tinyflows::triggers::graph_trigger_warnings;// The save/run safety predicates are `tinyflows-catalog`'s: whether a graph// fires unattended, whether it can act on the world, whether it has anything to// do at all are properties of the graph, not of this host. Re-exported at@@ -49,8 +48,10 @@ use crate::flows::draft_store;use crate::flows::store;use tinyflows_catalog::build_registry;pub(crate) use tinyflows_catalog::graph_policy::{- enforce_side_effect_approval, graph_has_actionable_nodes, trigger_is_automatic,+ enforce_side_effect_approval, trigger_is_automatic,};+#[cfg(test)]+pub(crate) use tinyflows_catalog::graph_policy::graph_has_actionable_nodes;use tinyflows_catalog::types::{FlowConnection, FlowRunTrigger, FlowSuggestion, SuggestionStatus};use {tinyflows_catalog::Flow, tinyflows_catalog::FlowRun};diff --git a/crates/openhuman-core/src/flows/ops/connections.rs b/crates/openhuman-core/src/flows/ops/connections.rsindex 0c119e409c..7451d9b6bb 100644--- a/crates/openhuman-core/src/flows/ops/connections.rs+++ b/crates/openhuman-core/src/flows/ops/connections.rs@@ -284,7 +284,13 @@ pub async fn flows_required_connections(config: &Config,graph_json: Value,) -> Result<Outcome<Value>, String> {- let graph = tinyflows::migrate::deserialize_graph(graph_json)?;+ let graph: tinyflows::model::WorkflowGraph = super::validation::migrate_over_bus(+ ctx,+ config,+ graph_json,+ )+ .await+ .and_then(|graph| serde_json::from_value(graph).map_err(|error| error.to_string()))?;let required = compute_required_connections(ctx, config, &graph).await;Ok(Outcome::single_log(json!({ "required_connections": required }),diff --git a/crates/openhuman-core/src/flows/ops/resume.rs b/crates/openhuman-core/src/flows/ops/resume.rsindex f263d2b9f7..e19839716b 100644--- a/crates/openhuman-core/src/flows/ops/resume.rs+++ b/crates/openhuman-core/src/flows/ops/resume.rs@@ -93,7 +93,9 @@ async fn current_workflow_for_resume(.await.map_err(|error| error.wire_message())?;let workflow = workflow.ok_or_else(|| format!("flow '{flow_id}' not found"))?;- let graph = tinyflows::migrate::deserialize_graph(workflow.graph)+ let graph = crate::flows::ops::validation::migrate_over_bus(ctx, config, workflow.graph)+ .await+ .and_then(|graph| serde_json::from_value(graph).map_err(|error| error.to_string())).map_err(|error| format!("decode workflow graph for resume: {error}"))?;Ok(ResumeWorkflow {graph,diff --git a/crates/openhuman-core/src/flows/ops/run.rs b/crates/openhuman-core/src/flows/ops/run.rsindex e53545045d..da7d1d8e5e 100644--- a/crates/openhuman-core/src/flows/ops/run.rs+++ b/crates/openhuman-core/src/flows/ops/run.rs@@ -127,7 +127,11 @@ pub(super) async fn prepare_flow_run(let flow: Flow =store::roundtrip(workflow.ok_or_else(|| format!("flow '{flow_id}' not found"))?).map_err(|error| format!("decode workflow for run: {error}"))?;- let no_actionable_nodes = !graph_has_actionable_nodes(&flow.graph);+ let graph_json = serde_json::to_value(&flow.graph).map_err(|error| error.to_string())?;+ let analysis = super::validation::validate_over_bus(ctx, config, graph_json).await?;+ let no_actionable_nodes = !analysis+ .has_actionable_nodes+ .ok_or_else(|| "TinyFlows validation returned no actionability result".to_string())?;if no_actionable_nodes {tracing::warn!(target: "flows",diff --git a/crates/openhuman-core/src/flows/ops/validation.rs b/crates/openhuman-core/src/flows/ops/validation.rsindex c189af1ef1..3bd1873ffe 100644--- a/crates/openhuman-core/src/flows/ops/validation.rs+++ b/crates/openhuman-core/src/flows/ops/validation.rs@@ -6,7 +6,7 @@ use tinyflows_bus::{GraphValidation, ImportGraphResult, ValidateGraphRequest};#[cfg(test)]pub(crate) use tinyflows::compat::UNSUPPORTED_NESTED_CONDITIONAL_FAN_IN;-async fn validate_over_bus(+pub(super) async fn validate_over_bus(ctx: &DispatchCtx,config: &Config,graph: Value,