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/builder_toolset.rs,crates/openhuman-core/sr

Steven Enamakel0b446dce449e
diff --git a/crates/openhuman-core/src/flows/ops/builder_toolset.rs b/crates/openhuman-core/src/flows/ops/builder_toolset.rs
index c24efdc5f0..ba352c97bf 100644
--- a/crates/openhuman-core/src/flows/ops/builder_toolset.rs
+++ b/crates/openhuman-core/src/flows/ops/builder_toolset.rs
@@ -133,10 +133,9 @@ pub(super) fn restrict_builder_toolset_for_copilot(agent: &mut crate::agent::Ope
tracing::info!(
target: "flows",
hidden = ?FLOWS_BUILD_COPILOT_HIDDEN_TOOLS,
- "[flows] flows_build: streaming copilot turn — run_flow/resume_flow_run/cancel_flow_run \
- stay visible (all three gated behind the WebChat approval surface; cancel_flow_run also \
- ownership-checks the target run's flow_id — T-M3 fix); only the unrelated legacy \
- run_workflow is hidden"
+ "[flows] flows_build: streaming copilot turn — run_flow/resume_flow_run stay visible \
+ behind the WebChat approval surface; cancel_flow_run and the unrelated legacy \
+ run_workflow are hidden"
);
agent.hide_tools(FLOWS_BUILD_COPILOT_HIDDEN_TOOLS);
}
diff --git a/crates/openhuman-core/src/flows/ops/definitions.rs b/crates/openhuman-core/src/flows/ops/definitions.rs
index 0b37130640..8f0b70835f 100644
--- a/crates/openhuman-core/src/flows/ops/definitions.rs
+++ b/crates/openhuman-core/src/flows/ops/definitions.rs
@@ -220,15 +220,12 @@ pub async fn flows_list(config: &Config) -> Result<Outcome<Vec<Flow>>, String> {
/// Deletes a flow by id.
///
-/// Unbinds the flow's automatic-dispatch trigger (e.g. the schedule-trigger
-/// cron job) *before* removing the flow definition. `flow_runs` cascades on
-/// delete via a same-database `FOREIGN KEY ... ON DELETE CASCADE`, but a
-/// bound cron job lives in the entirely separate `cron.db` — it does NOT
-/// cascade — so skipping this would orphan the cron job, leaving it pointing
-/// at a now-nonexistent `flow_id` forever. Best-effort: a lookup failure
-/// (flow already gone, store error) is logged and does not block the delete
-/// itself — `store::remove_flow` below still errors clearly if `id` doesn't
-/// exist.
+/// Removes the flow definition before unbinding its automatic-dispatch trigger
+/// (e.g. the schedule-trigger cron job). `flow_runs` cascades on delete via a
+/// same-database `FOREIGN KEY ... ON DELETE CASCADE`, but a bound cron job lives
+/// in the entirely separate `cron.db`. Removing the flow first means a failed
+/// delete leaves its still-existing schedule intact. Best-effort: a lookup
+/// failure is logged and does not block the delete itself.
pub async fn flows_delete(config: &Config, id: &str) -> Result<Outcome<Value>, String> {
flows_delete_with_remove(config, id, |config, id| {
store::remove_flow(config, id).map_err(|e| e.to_string())
@@ -243,15 +240,19 @@ pub(super) async fn flows_delete_with_remove(
id: &str,
remove: impl FnOnce(&Config, &str) -> Result<(), String>,
) -> Result<Outcome<Value>, String> {
- match store::get_flow(config, id) {
- Ok(Some(flow)) => unbind_trigger(config, &flow),
+ let flow = match store::get_flow(config, id) {
+ Ok(Some(flow)) => Some(flow),
Ok(None) => {}
Err(e) => {
tracing::warn!(target: "flows", flow_id = %id, error = %e, "[flows] flows_delete: failed to load flow before unbind — proceeding with delete anyway");
+ None
}
- }
+ };
remove(config, id)?;
+ if let Some(flow) = flow {
+ unbind_trigger(config, &flow);
+ }
tracing::debug!(target: "flows", flow_id = %id, "[flows] flows_delete: removed");
// Best-effort: purge the flow's pre-authorized tool trust with its row —
diff --git a/crates/openhuman-core/src/flows/ops/streaming.rs b/crates/openhuman-core/src/flows/ops/streaming.rs
index e0a62951a5..9a61da40ca 100644
--- a/crates/openhuman-core/src/flows/ops/streaming.rs
+++ b/crates/openhuman-core/src/flows/ops/streaming.rs
@@ -98,6 +98,7 @@ pub(super) async fn finalize_flow_stream(
target: &FlowStreamTarget,
result: &Result<String, String>,
prompt: &str,
+ config: &Config,
) {
match result {
Ok(text) => {
@@ -145,24 +146,22 @@ pub(super) async fn finalize_flow_stream(
// left non-terminal makes `threads_turn_state_get` report the turn as still
// running, so re-entering the thread paints a permanent "Thinking..."
// indicator under a reply that already landed.
- if let Ok(config) = ctx.load_config().await {
- let lifecycle = if result.is_ok() {
- tinyagents_session::turn_state::TurnLifecycle::Completed
- } else {
- tinyagents_session::turn_state::TurnLifecycle::Interrupted
- };
- let now = chrono::Utc::now().to_rfc3339();
- if let Err(err) = crate::agent::session_store::turn_states_for(&config.workspace_dir)
- .settle_turn(&target.thread_id, &target.request_id, lifecycle, &now)
- {
- tracing::warn!(
- target: "flows",
- thread_id = %target.thread_id,
- request_id = %target.request_id,
- error = %err,
- "[flows] failed to settle turn snapshot"
- );
- }
+ let lifecycle = if result.is_ok() {
+ tinyagents_session::turn_state::TurnLifecycle::Completed
+ } else {
+ tinyagents_session::turn_state::TurnLifecycle::Interrupted
+ };
+ let now = chrono::Utc::now().to_rfc3339();
+ if let Err(err) = crate::agent::session_store::turn_states_for(&config.workspace_dir)
+ .settle_turn(&target.thread_id, &target.request_id, lifecycle, &now)
+ {
+ tracing::warn!(
+ target: "flows",
+ thread_id = %target.thread_id,
+ request_id = %target.request_id,
+ error = %err,
+ "[flows] failed to settle turn snapshot"
+ );
}
tracing::info!(
target: "flows",
diff --git a/crates/openhuman-core/src/flows/schemas/run_schemas.rs b/crates/openhuman-core/src/flows/schemas/run_schemas.rs
index 63f75c2a98..6d087a6494 100644
--- a/crates/openhuman-core/src/flows/schemas/run_schemas.rs
+++ b/crates/openhuman-core/src/flows/schemas/run_schemas.rs
@@ -62,7 +62,11 @@ pub(super) fn lookup(function: &str) -> Option<ControllerSchema> {
FieldSchema {
name: "inputs",
ty: TypeSchema::Option(Box::new(TypeSchema::Json)),
- comment: "Values for the flow's declared workflow inputs, keyed by name (read the flow's `graph.inputs` for the declarations). Validated synchronously, so a bad set is refused here rather than surfacing later as a failed background run. Distinct from `input`, which is the free-form trigger payload.",
+ comment: "Values for the flow's declared workflow inputs, keyed by name \
+ (read the flow's `graph.inputs` for the declarations). Validated \
+ synchronously, so a bad set is refused here rather than surfacing \
+ later as a failed background run. Distinct from `input`, which is \
+ the free-form trigger payload.",
required: false,
},
],