Skip to content

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

test(flows): update builder repair tests for async bus API

Steven Enamakel81f5970e4f76
diff --git a/crates/openhuman-core/src/flows/ops_builder_repair_tests.rs b/crates/openhuman-core/src/flows/ops_builder_repair_tests.rs
index c69b242e18..af1242364e 100644
--- a/crates/openhuman-core/src/flows/ops_builder_repair_tests.rs
+++ b/crates/openhuman-core/src/flows/ops_builder_repair_tests.rs
@@ -3,7 +3,6 @@ use crate::core::runtime::DispatchCtx;
use crate::{
config::Config,
flows::{
- agents::workflow_builder::builder_prompt::{BuildMode, BuilderRequest},
ops::{
builder::{backend_repair_message, is_backend_or_infrastructure_failure},
flows_build_with_extra_hidden_tools, FlowStreamTarget,
@@ -11,36 +10,52 @@ use crate::{
},
};
-#[test]
-fn classifies_backend_failures_without_classifying_graph_timeouts() {
+#[tokio::test]
+async fn classifies_backend_failures_without_classifying_graph_timeouts() {
+ let config = Config::default();
assert!(is_backend_or_infrastructure_failure(
+ &config,
"File upload failed: Backend returned 500 Internal Server Error"
- ));
+ ).await.unwrap());
assert!(!is_backend_or_infrastructure_failure(
+ &config,
"File upload failed: Backend returned 400 Bad Request"
- ));
+ ).await.unwrap());
assert!(is_backend_or_infrastructure_failure(
+ &config,
"connection timed out while calling file storage"
- ));
+ ).await.unwrap());
assert!(is_backend_or_infrastructure_failure(
+ &config,
"POST https://api.example.test/files failed: connection timed out"
- ));
+ ).await.unwrap());
assert!(!is_backend_or_infrastructure_failure(
+ &config,
"agent node fetch_profile timed out after 30 seconds"
- ));
+ ).await.unwrap());
assert!(!is_backend_or_infrastructure_failure(
+ &config,
"required argument resolved null: nodes.get_link.item.json.url"
- ));
+ ).await.unwrap());
}
-#[test]
-fn backend_repair_message_explains_why_the_graph_was_preserved() {
- let message = backend_repair_message("HTTP 503 from file storage").unwrap();
+#[tokio::test]
+async fn backend_repair_message_explains_why_the_graph_was_preserved() {
+ let message = backend_repair_message(&Config::default(), "HTTP 503 from file storage")
+ .await
+ .unwrap()
+ .unwrap();
assert!(message.contains("workflow was not changed"));
assert!(message.contains("HTTP 503 from file storage"));
assert!(
- backend_repair_message("agent node fetch_profile timed out after 30 seconds").is_none()
+ backend_repair_message(
+ &Config::default(),
+ "agent node fetch_profile timed out after 30 seconds",
+ )
+ .await
+ .unwrap()
+ .is_none()
);
}
@@ -54,8 +69,8 @@ fn repair_backend_failure_returns_no_proposal_before_starting_the_builder() {
.expect("build agent-sized test runtime");
runtime.block_on(async {
- let req = BuilderRequest {
- mode: BuildMode::Repair,
+ let req = tinyflows_bus::copilot::BuilderPromptRequest {
+ mode: "repair".to_string(),
instruction: "repair the failed workflow".to_string(),
graph: Some(json!({"nodes": [], "edges": []})),
flow_id: Some("flow-1".to_string()),
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 10ef12e04e..cca14a8875 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
@@ -121,7 +121,10 @@ async fn flows_build_hides_the_live_run_tool_from_the_builder_belt() {
// belt name-resolution so the hide-list can't silently stop covering a
// live-run/resume tool.
use tinytools::Tool as _;
- let live_runner = crate::flows::tools::RunFlowTool::new(std::sync::Arc::new(config.clone()));
+ let live_runner = crate::flows::copilot_bus::BusCopilotTool::from_name(
+ std::sync::Arc::new(config.clone()),
+ "run_flow",
+ );
assert!(
live_runner.external_effect(),
"the flows live-runner must be external-effect for the #4593 concern to apply"