Skip to content

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

refactor(core): simplify run listing logic

Steven Enamakelcd5978d10bf0
diff --git a/crates/openhuman-core/src/flows/ops/run_management.rs b/crates/openhuman-core/src/flows/ops/run_management.rs
index fc948f5cd9..5138dd7118 100644
--- a/crates/openhuman-core/src/flows/ops/run_management.rs
+++ b/crates/openhuman-core/src/flows/ops/run_management.rs
@@ -1,6 +1,6 @@
use super::*;
-use tinyflows_bus::catalog::{self as wire, FlowRun as WireFlowRun};
+use tinyflows_bus::catalog as wire;
/// OpenHuman's default explicit run-history retention request. The module
/// owns pruning mechanics and protects live rows; this is the host-selected
/// history cap exposed by the manual prune RPC.
@@ -51,12 +51,7 @@ pub async fn flows_list_runs(
flow_id: flow_id.to_owned(),
limit,
};
- let runs: Vec<WireFlowRun> = catalog_call(config, wire::members::LIST_RUNS, request).await?;
- let runs = runs
- .into_iter()
- .map(crate::flows::store::roundtrip)
- .collect::<anyhow::Result<Vec<_>>>()
- .map_err(|error| error.to_string())?;
+ let runs: Vec<FlowRun> = catalog_call(config, wire::members::LIST_RUNS, request).await?;
Ok(Outcome::single_log(
runs,
format!("flow runs listed: {flow_id}"),
@@ -74,13 +69,8 @@ pub async fn flows_list_all_runs(
.await?
.storage();
let request = wire::ListAllRunsRequest { storage, limit };
- let runs: Vec<WireFlowRun> =
+ let runs: Vec<FlowRun> =
catalog_call(config, wire::members::LIST_ALL_RUNS, request).await?;
- let runs = runs
- .into_iter()
- .map(crate::flows::store::roundtrip)
- .collect::<anyhow::Result<Vec<_>>>()
- .map_err(|error| error.to_string())?;
let count = runs.len();
Ok(Outcome::single_log(
runs,
@@ -88,8 +78,8 @@ pub async fn flows_list_all_runs(
))
}
-/// Prune terminal run history while retaining the module's standard cap and
-/// every live or approval-parked run.
+/// Prune terminal run history at the host-selected retention cap; the module
+/// protects every live or approval-parked run.
pub async fn flows_prune_runs(config: &Config, flow_id: &str) -> Result<Outcome<Value>, String> {
let keep = FLOW_RUN_HISTORY_LIMIT;
let ctx = crate::core::runtime::DispatchCtx::ambient();