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
chore: files changed crates/openhuman-core/src/flows/ops/resume.rs,crates/openhuman-core/src/flows/o
Steven Enamakeleaa33558d552
diff --git a/crates/openhuman-core/src/flows/ops/resume.rs b/crates/openhuman-core/src/flows/ops/resume.rsindex ca59833f34..aa634fed79 100644--- a/crates/openhuman-core/src/flows/ops/resume.rs+++ b/crates/openhuman-core/src/flows/ops/resume.rs@@ -105,11 +105,9 @@ pub async fn flows_resume("[flows] flows_resume: refusing — the flow's graph changed after this run \parked (T-M1 stale-approval guard)");- // Settle the row FIRST and treat the guarded write as the- // authority, exactly as `flows_cancel_run` does (see its- // ORDER MATTERS note) — this refusal runs BEFORE this call- // claims the run, so a concurrent resume can legitimately own- // it by now:+ // Settle the row through a parked-only compare-and-swap —+ // this refusal runs before this call claims the run, so a+ // concurrent resume can legitimately own it by now://// 1. Resume B reads the flow and computes a matching hash.// 2. `flows_update` rewrites the flow.@@ -117,11 +115,11 @@ pub async fn flows_resume(// 4. Resume B wins `mark_run_resuming`, flips the row to// `running`, and starts executing approved side effects.//- // `finish_flow_run_row`'s guard admits `running` as well as- // `pending_approval`, so a blind write from A would relabel- // B's live row `cancelled`, overwrite `last_status`, and drop- // a checkpoint B is actively using. Acting only when the write- // actually matched keeps A's refusal from touching B's run.+ // The ordinary finish guard admits `running` as well as+ // `pending_approval`, so it would relabel B's live row+ // `cancelled`, overwrite `last_status`, and drop a checkpoint+ // B is actively using. The parked-only CAS makes the write+ // fail once B has claimed the row.//// A is refused either way: its own view of the graph is stale,// so it must never proceed regardless of who owns the row.@@ -167,14 +165,9 @@ pub async fn flows_resume(// 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) {- let settled_by_us = super::run_management::settle_parked_run(- config,- thread_id,- flow_id,- "failed",- &error,- )- .await;+ let settled_by_us =+ super::run_management::settle_parked_run(config, thread_id, flow_id, "failed", &error)+ .await;if !settled_by_us {tracing::info!(target: "flows",diff --git a/crates/openhuman-core/src/flows/ops/run_rows.rs b/crates/openhuman-core/src/flows/ops/run_rows.rsindex 02a5020a2c..9a2378b77c 100644--- a/crates/openhuman-core/src/flows/ops/run_rows.rs+++ b/crates/openhuman-core/src/flows/ops/run_rows.rs@@ -5,8 +5,7 @@ use super::*;/// tool abort, chat turn end, runtime shutdown, panic) before any terminal/// write landed. Surfaced verbatim in the run-details sidebar (bug B42c) so a/// cancelled/timed-out run reads as interrupted rather than a blank spinner.-pub(super) const INTERRUPTED_DROP_REASON: &str =- "Run interrupted before completion — it was cancelled, timed out, or the app shut down mid-run.";+pub(super) const INTERRUPTED_DROP_REASON: &str = "Run interrupted before completion — it was cancelled, timed out, or the app shut down mid-run.";/// Cancellation-safe finalizer for a live `flow_runs` row (bug B42).///diff --git a/crates/openhuman-core/src/flows/ops_builder_trail_off_tests.rs b/crates/openhuman-core/src/flows/ops_builder_trail_off_tests.rsindex 5ed90fac69..bc8c20bd05 100644--- a/crates/openhuman-core/src/flows/ops_builder_trail_off_tests.rs+++ b/crates/openhuman-core/src/flows/ops_builder_trail_off_tests.rs@@ -445,17 +445,9 @@ fn run_row_finalizer_does_not_record_interrupted_for_an_already_terminal_row() {let tmp = TempDir::new().unwrap();let (config, flow_id, run_id) = seed_running_run(&tmp);let now = Utc::now().to_rfc3339();- assert!(store::finish_flow_run(- &config,- &run_id,- "completed",- &now,- &[],- &[],- None,- None,- )- .unwrap());+ assert!(+ store::finish_flow_run(&config, &run_id, "completed", &now, &[], &[], None, None,).unwrap()+ );store::record_run(&config, &flow_id, "completed").unwrap();// A late drop must not rewrite the flow summary when its guarded rowdiff --git a/crates/openhuman-core/src/flows/ops_run_lifecycle_tests.rs b/crates/openhuman-core/src/flows/ops_run_lifecycle_tests.rsindex 05a36b7fe2..5ae969d96d 100644--- a/crates/openhuman-core/src/flows/ops_run_lifecycle_tests.rs+++ b/crates/openhuman-core/src/flows/ops_run_lifecycle_tests.rs@@ -1,19 +1,21 @@use super::*;-async fn insert_parked_run(config: &Config, flow_id: &str, run_id: &str) {+fn insert_parked_run(config: &Config, flow_id: &str, run_id: &str) {let now = Utc::now().to_rfc3339();store::insert_flow_run(config, run_id, flow_id, run_id, &now).unwrap();- assert!(store::finish_flow_run(- config,- run_id,- "pending_approval",- &now,- &[],- &["gate".into()],- None,- Some("parked-graph"),- )- .unwrap());+ assert!(+ store::finish_flow_run(+ config,+ run_id,+ "pending_approval",+ &now,+ &[],+ &["gate".into()],+ None,+ Some("parked-graph"),+ )+ .unwrap()+ );}#[tokio::test]@@ -29,19 +31,21 @@ async fn stale_graph_refusal_leaves_a_resume_claimed_run_and_summary_untouched()).unwrap();let run_id = "stale-graph-race-run";- insert_parked_run(&config, &flow.id, run_id).await;+ insert_parked_run(&config, &flow.id, run_id);// A winning resume claims the row between the stale graph check's read// and its attempted refusal write.assert!(store::mark_run_resuming(&config, run_id).unwrap());- assert!(!run_management::settle_parked_run(- &config,- run_id,- &flow.id,- "cancelled",- GRAPH_CHANGED_SINCE_PARK_ERROR,- )- .await);+ assert!(+ !run_management::settle_parked_run(+ &config,+ run_id,+ &flow.id,+ "cancelled",+ GRAPH_CHANGED_SINCE_PARK_ERROR,+ )+ .await+ );let row = store::get_flow_run(&config, run_id).unwrap().unwrap();assert_eq!(row.status, "running");@@ -62,17 +66,19 @@ async fn compatibility_refusal_does_not_label_a_resume_claimed_run_failed() {).unwrap();let run_id = "compatibility-race-run";- insert_parked_run(&config, &flow.id, run_id).await;+ insert_parked_run(&config, &flow.id, run_id);assert!(store::mark_run_resuming(&config, run_id).unwrap());- assert!(!run_management::settle_parked_run(- &config,- run_id,- &flow.id,- "failed",- "unsupported graph topology",- )- .await);+ assert!(+ !run_management::settle_parked_run(+ &config,+ run_id,+ &flow.id,+ "failed",+ "unsupported graph topology",+ )+ .await+ );let row = store::get_flow_run(&config, run_id).unwrap().unwrap();assert_eq!(row.status, "running");@@ -93,19 +99,15 @@ async fn cancel_observed_parked_does_not_tear_down_a_resume_starting() {).unwrap();let run_id = "cancel-start-race-run";- insert_parked_run(&config, &flow.id, run_id).await;+ insert_parked_run(&config, &flow.id, run_id);// Cancel already read `pending_approval` and found no registry entry;// resume then registers and claims the row before cancel's CAS.assert!(store::mark_run_resuming(&config, run_id).unwrap());- assert!(!run_management::settle_parked_run(- &config,- run_id,- &flow.id,- "cancelled",- "run cancelled"- )- .await);+ assert!(+ !run_management::settle_parked_run(&config, run_id, &flow.id, "cancelled", "run cancelled")+ .await+ );let row = store::get_flow_run(&config, run_id).unwrap().unwrap();assert_eq!(row.status, "running");