Skip to content

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

test(flows): exercise failing boot sweep path in regression test (#6010)

Sagar Kewat1474c6dadb1d
diff --git a/src/openhuman/flows/ops_tests_part_12_tests.rs b/src/openhuman/flows/ops_tests_part_12_tests.rs
index 5e7c31c8d5..e3015fb93d 100644
--- a/src/openhuman/flows/ops_tests_part_12_tests.rs
+++ b/src/openhuman/flows/ops_tests_part_12_tests.rs
@@ -632,8 +632,24 @@ async fn boot_sweep_skips_a_run_started_after_the_process_floor() {
);
}
-#[test]
-fn sweep_error_formatting_preserves_root_cause() {
+#[tokio::test]
+async fn boot_sweep_handles_schema_init_failure_gracefully() {
+ let tmp = TempDir::new().unwrap();
+ let file_path = tmp.path().join("not_a_dir");
+ std::fs::write(&file_path, b"blocking file").unwrap();
+
+ let config = Config {
+ workspace_dir: file_path.clone(),
+ action_dir: file_path.clone(),
+ config_path: tmp.path().join("config.toml"),
+ ..Config::default()
+ };
+
+ // Execute the failing sweep path to exercise error-handling branch
+ let swept = sweep_orphaned_running_runs_on_boot(&config).await;
+ assert_eq!(swept, 0);
+
+ // Verify error chain formatting preserves outer context and underlying cause
let inner = std::io::Error::new(
std::io::ErrorKind::PermissionDenied,
"disk permission denied",
@@ -643,3 +659,4 @@ fn sweep_error_formatting_preserves_root_cause() {
assert!(formatted.contains("Failed to initialize flows schema"));
assert!(formatted.contains("disk permission denied"));
}
+