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): thread dispatch context through engine compatibility checks
Steven Enamakelaac7cc01ed52
diff --git a/crates/openhuman-core/src/flows/ops/definitions.rs b/crates/openhuman-core/src/flows/ops/definitions.rsindex bde9d4d11f..8e7b9a1994 100644--- a/crates/openhuman-core/src/flows/ops/definitions.rs+++ b/crates/openhuman-core/src/flows/ops/definitions.rs@@ -182,7 +182,7 @@ pub(crate) async fn load_engine_compatible_flow_graph() -> Result<Option<WorkflowGraph>, String> {let graph = load_flow_graph(config, id)?;if let Some(graph) = graph.as_ref() {- ensure_config_aware_engine_compatible(config, graph).await+ ensure_config_aware_engine_compatible(&crate::core::runtime::DispatchCtx::ambient(), config, graph).await.map_err(|error| format!("workflow_id '{id}' is engine-incompatible: {error}"))?;}Ok(graph)diff --git a/crates/openhuman-core/src/flows/ops/resume.rs b/crates/openhuman-core/src/flows/ops/resume.rsindex 104f792f93..9dc649031c 100644--- a/crates/openhuman-core/src/flows/ops/resume.rs+++ b/crates/openhuman-core/src/flows/ops/resume.rs@@ -193,7 +193,7 @@ where// A pending checkpoint may have been created before this compatibility// gate shipped, so resume is an independent authoritative boundary.- if let Err(error) = ensure_config_aware_engine_compatible(config, &flow.graph).await {+ if let Err(error) = ensure_config_aware_engine_compatible(ctx, config, &flow.graph).await {before_refusal_settle();let settled_by_us =super::run_management::settle_parked_run(config, thread_id, flow_id, "failed", &error)diff --git a/crates/openhuman-core/src/flows/ops/run.rs b/crates/openhuman-core/src/flows/ops/run.rsindex e3ec056d92..c648543304 100644--- a/crates/openhuman-core/src/flows/ops/run.rs+++ b/crates/openhuman-core/src/flows/ops/run.rs@@ -35,7 +35,7 @@ pub async fn flows_run(// to the shared run body. Both the synchronous "Run" RPC path (this fn) and// the detached agent path ([`flows_run_detached`]) reuse `run_flow_body` so// a single [`RunRowFinalizer`] guards the row on every exit — bug B42.- let prepared = prepare_flow_run(config, flow_id, &inputs).await?;+ let prepared = prepare_flow_run(ctx, config, flow_id, &inputs).await?;let thread_id = prepared.thread_id.clone();let no_actionable_nodes = prepared.no_actionable_nodes;let resolved_inputs = prepared.inputs;@@ -93,7 +93,7 @@ pub async fn flows_run_detached(inputs: serde_json::Map<String, Value>,trigger: FlowRunTrigger,) -> Result<Outcome<Value>, String> {- let prepared = prepare_flow_run(config, flow_id, &inputs).await?;+ let prepared = prepare_flow_run(ctx, config, flow_id, &inputs).await?;let thread_id = prepared.thread_id.clone();let no_actionable_nodes = prepared.no_actionable_nodes;let resolved_inputs = prepared.inputs;@@ -195,6 +195,7 @@ pub(super) struct PreparedFlowRun {/// contract); doing it twice is cheap and keeps this host from having to trust/// its own copy of the rules.pub(super) async fn prepare_flow_run(+ ctx: &crate::core::runtime::DispatchCtx,config: &Config,flow_id: &str,inputs: &serde_json::Map<String, Value>,@@ -228,7 +229,7 @@ pub(super) async fn prepare_flow_run(// Author-time validation cannot protect definitions persisted by an older// OpenHuman build. Re-check immediately before compilation so an upgrade// fails explicitly instead of silently committing incomplete merge data.- if let Err(error) = ensure_config_aware_engine_compatible(config, &flow.graph).await {+ if let Err(error) = ensure_config_aware_engine_compatible(ctx, config, &flow.graph).await {tracing::warn!(target: "flows",flow_id = %flow_id,diff --git a/crates/openhuman-core/src/flows/ops/validation.rs b/crates/openhuman-core/src/flows/ops/validation.rsindex bf68aa4fdf..8ca9810a13 100644--- a/crates/openhuman-core/src/flows/ops/validation.rs+++ b/crates/openhuman-core/src/flows/ops/validation.rs@@ -61,12 +61,12 @@ pub(crate) async fn config_aware_engine_compatibility_errors(}pub(super) async fn ensure_config_aware_engine_compatible(+ ctx: &DispatchCtx,config: &Config,graph: &WorkflowGraph,) -> Result<(), String> {let graph = serde_json::to_value(graph).map_err(|error| error.to_string())?;- match config_aware_engine_compatibility_errors(&DispatchCtx::ambient(), config, graph)- .await?+ match config_aware_engine_compatibility_errors(ctx, config, graph).await?.into_iter().next(){