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
test(flows): cover streamed backend-repair short-circuit
Steven Enamakel1229e6121dd2
diff --git a/crates/openhuman-core/src/flows/ops_builder_repair_tests.rs b/crates/openhuman-core/src/flows/ops_builder_repair_tests.rsindex d3697d31b8..15677e5f35 100644--- a/crates/openhuman-core/src/flows/ops_builder_repair_tests.rs+++ b/crates/openhuman-core/src/flows/ops_builder_repair_tests.rs@@ -5,7 +5,7 @@ use crate::{agents::workflow_builder::builder_prompt::{BuildMode, BuilderRequest},ops::{builder::{backend_repair_message, is_backend_or_infrastructure_failure},- flows_build_with_extra_hidden_tools,+ flows_build_with_extra_hidden_tools, FlowStreamTarget,},},};@@ -49,7 +49,7 @@ async fn repair_backend_failure_returns_no_proposal_before_starting_the_builder(failing_node_ids: vec!["fetch".to_string()],};- let outcome = flows_build_with_extra_hidden_tools(&Config::default(), req, None, &[])+ let outcome = flows_build_with_extra_hidden_tools(&Config::default(), req.clone(), None, &[]).await.expect("backend failure should short-circuit before the builder starts");@@ -61,4 +61,31 @@ async fn repair_backend_failure_returns_no_proposal_before_starting_the_builder(.expect("assistant text").contains("workflow was not changed"));++ let request_id = format!("backend-repair-{}", uuid::Uuid::new_v4());+ let stream = FlowStreamTarget {+ thread_id: "backend-repair-thread".to_string(),+ request_id: request_id.clone(),+ };+ let mut events = crate::web_chat::subscribe_web_channel_events();++ flows_build_with_extra_hidden_tools(&Config::default(), req, Some(stream), &[])+ .await+ .expect("streamed backend failure should short-circuit before the builder starts");++ let done = loop {+ match events.try_recv() {+ Ok(event) if event.request_id == request_id => break event,+ Ok(_) | Err(tokio::sync::broadcast::error::TryRecvError::Lagged(_)) => continue,+ Err(error) => panic!("missing streamed backend-repair event: {error}"),+ }+ };+ assert_eq!(done.event, "chat_done");+ assert_eq!(done.thread_id, "backend-repair-thread");+ assert!(+ done.full_response+ .as_deref()+ .expect("terminal response text")+ .contains("workflow was not changed")+ );}