Skip to content

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

refactor(flows): thread dispatch context into workflow resolver

Steven Enamakelff20e529d2de
diff --git a/crates/openhuman-core/src/flows/ops/definitions.rs b/crates/openhuman-core/src/flows/ops/definitions.rs
index 8e7b9a1994..8d9fa44009 100644
--- a/crates/openhuman-core/src/flows/ops/definitions.rs
+++ b/crates/openhuman-core/src/flows/ops/definitions.rs
@@ -177,12 +177,13 @@ pub fn load_flow_graph(config: &Config, id: &str) -> Result<Option<WorkflowGraph
/// so a legacy draft can still be opened and repaired; execution resolves only
/// graphs the current engine can run safely.
pub(crate) async fn load_engine_compatible_flow_graph(
+ ctx: &crate::core::runtime::DispatchCtx,
config: &Config,
id: &str,
) -> Result<Option<WorkflowGraph>, String> {
let graph = load_flow_graph(config, id)?;
if let Some(graph) = graph.as_ref() {
- ensure_config_aware_engine_compatible(&crate::core::runtime::DispatchCtx::ambient(), config, graph).await
+ ensure_config_aware_engine_compatible(ctx, config, graph).await
.map_err(|error| format!("workflow_id '{id}' is engine-incompatible: {error}"))?;
}
Ok(graph)
diff --git a/crates/openhuman-core/src/flows/tinyflows/caps/ops.rs b/crates/openhuman-core/src/flows/tinyflows/caps/ops.rs
index 9df7c4f112..c5b1b5e4a1 100644
--- a/crates/openhuman-core/src/flows/tinyflows/caps/ops.rs
+++ b/crates/openhuman-core/src/flows/tinyflows/caps/ops.rs
@@ -281,7 +281,10 @@ pub fn build_capabilities(
approval,
},
)),
- resolver: Arc::new(OpenHumanWorkflowResolver { config }),
+ resolver: Arc::new(OpenHumanWorkflowResolver {
+ ctx: ctx.clone(),
+ config,
+ }),
}
}
diff --git a/crates/openhuman-core/src/flows/tinyflows/caps/resolver.rs b/crates/openhuman-core/src/flows/tinyflows/caps/resolver.rs
index 7bfb6db87e..83952d509a 100644
--- a/crates/openhuman-core/src/flows/tinyflows/caps/resolver.rs
+++ b/crates/openhuman-core/src/flows/tinyflows/caps/resolver.rs
@@ -29,6 +29,7 @@ use tinyflows::model::WorkflowGraph;
/// rejects direct self-references before a child runs, so this adapter does not
/// itself need cycle detection — it is a pure id → graph lookup.
pub struct OpenHumanWorkflowResolver {
+ pub ctx: crate::core::runtime::DispatchCtx,
pub config: Arc<Config>,
}
@@ -40,7 +41,7 @@ impl WorkflowResolver for OpenHumanWorkflowResolver {
%workflow_id,
"[flows] sub_workflow resolver: resolving workflow_id to a saved flow graph"
);
- let loaded = flows::ops::load_engine_compatible_flow_graph(&self.config, workflow_id).await;
+ let loaded = flows::ops::load_engine_compatible_flow_graph(&self.ctx, &self.config, workflow_id).await;
match loaded {
Ok(Some(graph)) => {
tracing::debug!(