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 through draft promotion

Steven Enamakel6900f696fbff
diff --git a/crates/openhuman-core/src/flows/ops/drafts.rs b/crates/openhuman-core/src/flows/ops/drafts.rs
index 4a68d3ea66..8b846cd88c 100644
--- a/crates/openhuman-core/src/flows/ops/drafts.rs
+++ b/crates/openhuman-core/src/flows/ops/drafts.rs
@@ -84,6 +84,21 @@ pub async fn flows_draft_promote(
config: &Config,
id: &str,
require_approval: Option<bool>,
+) -> Result<Outcome<Flow>, String> {
+ flows_draft_promote_with_context(
+ &crate::core::runtime::DispatchCtx::ambient(),
+ config,
+ id,
+ require_approval,
+ )
+ .await
+}
+
+pub(crate) async fn flows_draft_promote_with_context(
+ ctx: &crate::core::runtime::DispatchCtx,
+ config: &Config,
+ id: &str,
+ require_approval: Option<bool>,
) -> Result<Outcome<Flow>, String> {
let draft = draft_store::get_draft(config, id)
.map_err(|e| e.to_string())?
@@ -98,7 +113,8 @@ pub async fn flows_draft_promote(
let outcome = match &draft.flow_id {
Some(flow_id) => {
- flows_update(
+ flows_update_with_context(
+ ctx,
config,
flow_id,
Some(draft.name.clone()),
@@ -109,7 +125,8 @@ pub async fn flows_draft_promote(
.await?
}
None => {
- flows_create(
+ flows_create_with_context(
+ ctx,
config,
draft.name.clone(),
draft.graph.clone(),