Skip to content

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

chore: files changed crates/openhuman-core/src/flows/ops/definitions.rs,crates/openhuman-core/src/fl

Steven Enamakel05783d07bdf6
diff --git a/crates/openhuman-core/src/flows/ops/definitions.rs b/crates/openhuman-core/src/flows/ops/definitions.rs
index b6cbb24ab1..c7ca9f7d8c 100644
--- a/crates/openhuman-core/src/flows/ops/definitions.rs
+++ b/crates/openhuman-core/src/flows/ops/definitions.rs
@@ -74,8 +74,9 @@ pub(crate) async fn flows_create_with_context(
graph_json: Value,
require_approval: bool,
) -> Result<Outcome<Flow>, String> {
- let graph = validate_and_migrate_graph(ctx, config, graph_json).await?;
- ensure_config_aware_engine_compatible(ctx, config, &graph).await?;
+ ctx.enter(async move {
+ let graph = validate_and_migrate_graph(ctx, config, graph_json).await?;
+ ensure_config_aware_engine_compatible(ctx, config, &graph).await?;
// Rule 1: automatic triggers create DISABLED — the user must arm them
// explicitly.
@@ -131,8 +132,10 @@ pub(crate) async fn flows_create_with_context(
);
}
- publish_flow_changed(&flow.id, "created", "system");
- Ok(Outcome::new(flow, logs))
+ publish_flow_changed(&flow.id, "created", "system");
+ Ok(Outcome::new(flow, logs))
+ })
+ .await
}
/// Duplicates a saved flow: creates an independent copy of its graph under a
diff --git a/crates/openhuman-core/src/flows/ops/drafts.rs b/crates/openhuman-core/src/flows/ops/drafts.rs
index 8b846cd88c..afa90e2cb4 100644
--- a/crates/openhuman-core/src/flows/ops/drafts.rs
+++ b/crates/openhuman-core/src/flows/ops/drafts.rs
@@ -100,9 +100,10 @@ pub(crate) async fn flows_draft_promote_with_context(
id: &str,
require_approval: Option<bool>,
) -> Result<Outcome<Flow>, String> {
- let draft = draft_store::get_draft(config, id)
- .map_err(|e| e.to_string())?
- .ok_or_else(|| format!("draft '{id}' not found"))?;
+ ctx.enter(async move {
+ let draft = draft_store::get_draft(config, id)
+ .map_err(|e| e.to_string())?
+ .ok_or_else(|| format!("draft '{id}' not found"))?;
tracing::debug!(
target: "flows",
@@ -140,5 +141,7 @@ pub(crate) async fn flows_draft_promote_with_context(
if let Err(e) = draft_store::delete_draft(config, id) {
tracing::warn!(target: "flows", draft_id = %id, error = %e, "[flows] flows_draft_promote: flow saved but draft file could not be removed");
}
- Ok(outcome)
+ Ok(outcome)
+ })
+ .await
}
diff --git a/crates/openhuman-core/src/flows/ops/updates.rs b/crates/openhuman-core/src/flows/ops/updates.rs
index 9d22f046df..0460095d17 100644
--- a/crates/openhuman-core/src/flows/ops/updates.rs
+++ b/crates/openhuman-core/src/flows/ops/updates.rs
@@ -94,16 +94,19 @@ pub(crate) async fn flows_update_with_context(
require_approval: Option<bool>,
expected_version: Option<String>,
) -> Result<Outcome<Flow>, String> {
- flows_update_inner(
- ctx,
- config,
- id,
- name,
- graph_json,
- require_approval,
- expected_version,
- false,
- )
+ ctx.enter(async move {
+ flows_update_inner(
+ ctx,
+ config,
+ id,
+ name,
+ graph_json,
+ require_approval,
+ expected_version,
+ false,
+ )
+ .await
+ })
.await
}
@@ -301,19 +304,22 @@ pub(crate) async fn flows_rollback_with_context(
revision_id: &str,
expected_version: Option<String>,
) -> Result<Outcome<Flow>, String> {
- let rev = store::revision_by_id(config, id, revision_id)
- .map_err(|e| e.to_string())?
- .ok_or_else(|| format!("revision '{revision_id}' not found for flow '{id}'"))?;
+ ctx.enter(async move {
+ let rev = store::revision_by_id(config, id, revision_id)
+ .map_err(|e| e.to_string())?
+ .ok_or_else(|| format!("revision '{revision_id}' not found for flow '{id}'"))?;
- tracing::debug!(target: "flows", flow_id = %id, %revision_id, "[flows] flows_rollback: restoring prior revision");
- flows_update_with_context(
- ctx,
- config,
- id,
- Some(rev.name),
- Some(rev.graph),
- Some(rev.require_approval),
- expected_version,
- )
+ tracing::debug!(target: "flows", flow_id = %id, %revision_id, "[flows] flows_rollback: restoring prior revision");
+ flows_update_with_context(
+ ctx,
+ config,
+ id,
+ Some(rev.name),
+ Some(rev.graph),
+ Some(rev.require_approval),
+ expected_version,
+ )
+ .await
+ })
.await
}