Skip to content

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

fix(ops): handle empty row set in run_rows operation

Steven Enamakel23e531c10bba
diff --git a/crates/openhuman-core/src/flows/ops/run_rows.rs b/crates/openhuman-core/src/flows/ops/run_rows.rs
index 8a75eadd09..0b7e6bdde2 100644
--- a/crates/openhuman-core/src/flows/ops/run_rows.rs
+++ b/crates/openhuman-core/src/flows/ops/run_rows.rs
@@ -262,47 +262,6 @@ pub(super) fn settle_steps(config: &Config, run_id: &str, output: &Value) -> Vec
merged
}
-/// Degrades a would-be `"completed"` status: `"failed"` if any settled step
-/// errored, `"completed_with_warnings"` if any carries null-resolution
-/// diagnostics, else `"completed"`.
-///
-/// Called only once the run has no `pending_approvals` left — precedence
-/// against that case is handled by the caller (`pending_approval` always
-/// wins over any of these).
-pub(super) fn degrade_completed_status(steps: &[FlowRunStep]) -> &'static str {
- if steps.iter().any(|s| s.status.as_deref() == Some("error")) {
- return "failed";
- }
- if steps.iter().any(|s| !s.diagnostics.is_empty()) {
- "completed_with_warnings"
- } else {
- "completed"
- }
-}
-
-/// Names the node(s) whose step settled with `status == "error"` — the
-/// engine's `ExecutionStep` carries no error message of its own for a step
-/// that failed under an `on_error: "continue"`/`"route"` policy (it only
-/// fails the *run* future, and so gets an actual error string, when the
-/// policy is `"stop"`), so this is the best available detail for
-/// [`FlowRun::error`] when [`degrade_completed_status`] degrades to
-/// `"failed"` without an outer run-future `Err`.
-pub(super) fn failed_step_error_summary(steps: &[FlowRunStep]) -> Option<String> {
- let failed_nodes: Vec<&str> = steps
- .iter()
- .filter(|s| s.status.as_deref() == Some("error"))
- .map(|s| s.node_id.as_str())
- .collect();
- if failed_nodes.is_empty() {
- None
- } else {
- Some(format!(
- "node(s) failed after retries: {}",
- failed_nodes.join(", ")
- ))
- }
-}
-
/// Computes a settled run's terminal status and, when that status is
/// `"failed"`, an accompanying error message — shared by `flows_run` and
/// `flows_resume` so the two call sites can't drift on the
diff --git a/crates/openhuman-core/src/flows/ops_run_status_and_prompt_binding_tests.rs b/crates/openhuman-core/src/flows/ops_run_status_and_prompt_binding_tests.rs
index 41ebc161c1..5b3608cd07 100644
--- a/crates/openhuman-core/src/flows/ops_run_status_and_prompt_binding_tests.rs
+++ b/crates/openhuman-core/src/flows/ops_run_status_and_prompt_binding_tests.rs
@@ -81,69 +81,6 @@ async fn graph_wiring_warnings_uses_the_probed_output_fields_when_schema_is_unkn
);
}
-#[test]
-fn degrade_completed_status_all_clean_stays_completed() {
- let steps = vec![clean_step("a"), clean_step("b")];
- assert_eq!(degrade_completed_status(&steps), "completed");
-}
-
-#[test]
-fn degrade_completed_status_null_binding_becomes_warnings() {
- let mut warned = clean_step("a");
- warned.diagnostics = vec![json!({ "location": "args.to", "expression": "=item.to" })];
- let steps = vec![clean_step("trigger"), warned];
- assert_eq!(degrade_completed_status(&steps), "completed_with_warnings");
-}
-
-#[test]
-fn degrade_completed_status_errored_step_becomes_failed() {
- let mut errored = clean_step("a");
- errored.status = Some("error".to_string());
- let steps = vec![clean_step("trigger"), errored];
- assert_eq!(degrade_completed_status(&steps), "failed");
-}
-
-#[test]
-fn degrade_completed_status_error_outranks_diagnostics() {
- // A step can carry both an error status and null-resolution diagnostics
- // (e.g. it errored trying to use the unresolved value) — failed wins.
- let mut errored_with_diagnostics = clean_step("a");
- errored_with_diagnostics.status = Some("error".to_string());
- errored_with_diagnostics.diagnostics =
- vec![json!({ "location": "args.to", "expression": "=item.to" })];
- let steps = vec![errored_with_diagnostics];
- assert_eq!(degrade_completed_status(&steps), "failed");
-}
-
-#[test]
-fn failed_step_error_summary_none_when_no_step_errored() {
- let steps = vec![clean_step("a"), clean_step("b")];
- assert_eq!(failed_step_error_summary(&steps), None);
-}
-
-#[test]
-fn failed_step_error_summary_names_the_errored_node() {
- let mut errored = clean_step("x");
- errored.status = Some("error".to_string());
- let steps = vec![clean_step("trigger"), errored];
- let summary = failed_step_error_summary(&steps).expect("an errored step must summarize");
- assert!(summary.contains('x'), "got: {summary}");
-}
-
-#[test]
-fn failed_step_error_summary_names_every_errored_node() {
- let mut errored_a = clean_step("a");
- errored_a.status = Some("error".to_string());
- let mut errored_b = clean_step("b");
- errored_b.status = Some("error".to_string());
- let steps = vec![errored_a, errored_b];
- let summary = failed_step_error_summary(&steps).unwrap();
- assert!(
- summary.contains('a') && summary.contains('b'),
- "got: {summary}"
- );
-}
-
#[test]
fn agent_prompt_binding_unaffected() {
// The field-addressability checks are scoped to `tool_call` `args` only