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
refactor(tests): update test hooks to use configurable park duration
Steven Enamakelc0ff1a399ffb
diff --git a/crates/openhuman-core/src/channels/bus/subscriber_tests.rs b/crates/openhuman-core/src/channels/bus/subscriber_tests.rsindex b6c6ddf969..0e2b70cb67 100644--- a/crates/openhuman-core/src/channels/bus/subscriber_tests.rs+++ b/crates/openhuman-core/src/channels/bus/subscriber_tests.rs@@ -34,6 +34,7 @@ async fn backend_channel_wait_does_not_cut_off_a_live_turn_after_180_seconds() {started: Default::default(),dropped: Default::default(),release: Default::default(),+ max_park_for: Duration::from_secs(300),succeed_in: Some(tempfile::tempdir().expect("temporary workspace").keep()),};crate::web_chat::set_test_run_chat_task_block(Some(block.clone())).await;diff --git a/crates/openhuman-core/src/web_chat/ops/test_hooks.rs b/crates/openhuman-core/src/web_chat/ops/test_hooks.rsindex 9c27b23c61..bf6aeed58c 100644--- a/crates/openhuman-core/src/web_chat/ops/test_hooks.rs+++ b/crates/openhuman-core/src/web_chat/ops/test_hooks.rs@@ -23,6 +23,10 @@ pub struct TestRunChatTaskBlock {/// Lets a test end a parked turn without using cancellation, so it can/// exercise terminal queue handling such as follow-up dispatch.pub release: std::sync::Arc<tokio::sync::Notify>,+ /// Maximum virtual wall time to keep the controlled turn parked before+ /// returning the fixture's elapsed result. Existing tests use 30 seconds;+ /// long-turn ingress tests can select a larger value.+ pub max_park_for: std::time::Duration,/// When set, a released turn succeeds with a fixed reply stored under/// this workspace instead of failing, so success delivery is observable.pub succeed_in: Option<std::path::PathBuf>,@@ -137,7 +141,7 @@ pub(crate) async fn run_test_hooks(}None => Err("test block released".to_string()),}),- _ = tokio::time::sleep(std::time::Duration::from_secs(30)) => {+ _ = tokio::time::sleep(block.max_park_for) => {Some(Err("test block elapsed".to_string()))}}@@ -156,6 +160,7 @@ pub(crate) async fn track_parallel_turn_for_test(started: Default::default(),dropped: Default::default(),release: Default::default(),+ max_park_for: std::time::Duration::from_secs(30),succeed_in: None,};set_test_run_chat_task_block(Some(block.clone())).await;diff --git a/crates/openhuman-core/src/web_chat/web_tests.rs b/crates/openhuman-core/src/web_chat/web_tests.rsindex 0e59a1e49b..88f9ce1ff2 100644--- a/crates/openhuman-core/src/web_chat/web_tests.rs+++ b/crates/openhuman-core/src/web_chat/web_tests.rs@@ -1,5 +1,4 @@use super::{- ChatRequestMetadata, ClassifiedError, StartChatError, TestRunChatTaskBlock, WebChatParams,all_web_channel_controller_schemas, all_web_channel_registered_controllers, cancel_chat_scoped,channel_web_cancel, channel_web_queue_clear, channel_web_queue_remove,channel_web_queue_status, classify_inference_error, drain_queued_turns_for_test,@@ -8,13 +7,14 @@ use super::{locale_reply_directive, normalize_model_override, parallel_in_flight_entries_for_test,provider_role_for_model_override, schemas, sentry_suppression_reason,set_test_forced_run_chat_task_error, set_test_run_chat_task_block, start_chat,- subscribe_web_channel_events,+ subscribe_web_channel_events, ChatRequestMetadata, ClassifiedError, StartChatError,+ TestRunChatTaskBlock, WebChatParams,};use crate::core::TypeSchema;-use std::sync::Arc;use std::sync::atomic::{AtomicBool, Ordering};+use std::sync::Arc;use tinyagents_harness::run_queue::QueueLane;-use tokio::time::{Duration, timeout};+use tokio::time::{timeout, Duration};// Serializes every test that drives `start_chat` with the process-global// `run_chat_task` test hooks (forced error / forced block) or the@@ -103,6 +103,7 @@ fn make_block() -> TestRunChatTaskBlock {started: Arc::new(AtomicBool::new(false)),dropped: Arc::new(AtomicBool::new(false)),release: Arc::new(tokio::sync::Notify::new()),+ max_park_for: Duration::from_secs(30),succeed_in: None,}}diff --git a/crates/openhuman-core/src/web_chat/web_tests_error_code_classification_tests.rs b/crates/openhuman-core/src/web_chat/web_tests_error_code_classification_tests.rsindex 309e1d9783..3b9cd1161e 100644--- a/crates/openhuman-core/src/web_chat/web_tests_error_code_classification_tests.rs+++ b/crates/openhuman-core/src/web_chat/web_tests_error_code_classification_tests.rs@@ -465,16 +465,14 @@ fn chat_schema_requires_client_thread_message() {assert!(required.contains(&"thread_id"));assert!(required.contains(&"message"));// model_override and temperature must be optional.- assert!(- s.inputs- .iter()- .any(|f| f.name == "model_override" && !f.required)- );- assert!(- s.inputs- .iter()- .any(|f| f.name == "temperature" && !f.required)- );+ assert!(s+ .inputs+ .iter()+ .any(|f| f.name == "model_override" && !f.required));+ assert!(s+ .inputs+ .iter()+ .any(|f| f.name == "temperature" && !f.required));}#[test]diff --git a/crates/openhuman-core/src/web_chat/web_tests_error_copy_fixture_tests.rs b/crates/openhuman-core/src/web_chat/web_tests_error_copy_fixture_tests.rsindex 087660f585..88d760b201 100644--- a/crates/openhuman-core/src/web_chat/web_tests_error_copy_fixture_tests.rs+++ b/crates/openhuman-core/src/web_chat/web_tests_error_copy_fixture_tests.rs@@ -8,7 +8,7 @@//! (web_chat regex list, triage whole-word list, loop-guard billing list).use super::*;-use crate::agent::triage::evaluator::{ArmError, classify_error};+use crate::agent::triage::evaluator::{classify_error, ArmError};use regex::Regex;/// `(case, input, error_type, source, retryable, retry_after_ms, provider,@@ -652,9 +652,8 @@ fn shared_budget_matcher_reproduces_each_legacy_matcher_on_the_corpus() {#[test]fn loop_guard_halt_summaries_are_byte_identical() {use crate::inference::failure_copy::{- TerminalInferenceFailure, recoverable_identical_halt_summary,- recoverable_no_progress_halt_summary, terminal_inference_halt_summary,- user_actionable_escalation,+ recoverable_identical_halt_summary, recoverable_no_progress_halt_summary,+ terminal_inference_halt_summary, user_actionable_escalation, TerminalInferenceFailure,};assert_eq!(terminal_inference_halt_summary(diff --git a/crates/openhuman-core/src/web_chat/web_tests_queue_acceptance_tests.rs b/crates/openhuman-core/src/web_chat/web_tests_queue_acceptance_tests.rsindex e17f01b11d..8350175e26 100644--- a/crates/openhuman-core/src/web_chat/web_tests_queue_acceptance_tests.rs+++ b/crates/openhuman-core/src/web_chat/web_tests_queue_acceptance_tests.rs@@ -169,11 +169,9 @@ async fn terminal_turn_dispatches_followup_as_a_fresh_host_turn() {.any(|(key, request_id)| key == thread_id && request_id != &primary_request_id)}).await;- assert!(- entries- .iter()- .any(|(key, request_id)| key == thread_id && request_id != &primary_request_id)- );+ assert!(entries+ .iter()+ .any(|(key, request_id)| key == thread_id && request_id != &primary_request_id));cancel_parked_turn(thread_id, &block).await;}@@ -235,33 +233,27 @@ async fn cancellation_discards_pending_lanes_before_a_replacement_turn() {.await.expect("replacement queue status should be available");assert_eq!(replacement.value["total"], 0);- assert!(- drain_queued_turns_for_test(- &crate::core::runtime::DispatchCtx::ambient(),- thread_id,- QueueLane::Followup- )- .await- .is_empty()- );- assert!(- drain_queued_turns_for_test(- &crate::core::runtime::DispatchCtx::ambient(),- thread_id,- QueueLane::Steer- )- .await- .is_empty()- );- assert!(- drain_queued_turns_for_test(- &crate::core::runtime::DispatchCtx::ambient(),- thread_id,- QueueLane::Collect- )- .await- .is_empty()- );+ assert!(drain_queued_turns_for_test(+ &crate::core::runtime::DispatchCtx::ambient(),+ thread_id,+ QueueLane::Followup+ )+ .await+ .is_empty());+ assert!(drain_queued_turns_for_test(+ &crate::core::runtime::DispatchCtx::ambient(),+ thread_id,+ QueueLane::Steer+ )+ .await+ .is_empty());+ assert!(drain_queued_turns_for_test(+ &crate::core::runtime::DispatchCtx::ambient(),+ thread_id,+ QueueLane::Collect+ )+ .await+ .is_empty());cancel_parked_turn(thread_id, &replacement_block).await;}@@ -322,12 +314,10 @@ async fn web_queue_status_wire_shape_and_clear_cleanup_remain_stable() {assert_eq!(lanes, ["collect", "followup", "steer"]);for item in items {assert!(!item["id"].as_str().expect("id").is_empty());- assert!(- item["text_preview"]- .as_str()- .expect("text_preview")- .ends_with("payload")- );+ assert!(item["text_preview"]+ .as_str()+ .expect("text_preview")+ .ends_with("payload"));}let cleared = channel_web_queue_clear(&DispatchCtx::ambient(), thread_id)