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(channels): box progressive transport outcomes and reorder test modules
Steven Enamakelb96c178c8e30
diff --git a/crates/openhuman-core/src/channels/runtime/startup/callback.rs b/crates/openhuman-core/src/channels/runtime/startup/callback.rsindex 6a8dd1cb47..236a5f6e03 100644--- a/crates/openhuman-core/src/channels/runtime/startup/callback.rs+++ b/crates/openhuman-core/src/channels/runtime/startup/callback.rs@@ -104,10 +104,6 @@ impl ChannelHostCallbacks {}}-#[cfg(test)]-#[path = "callback_tests.rs"]-mod tests;-#[tinybus::interface(name = "ai.tinyhumans.tinychannels.ChannelsHost")]impl ChannelHostCallbacks {async fn deliver_inbound(&self, channel: String, message: serde_json::Value) -> Result<()> {@@ -281,6 +277,10 @@ impl ChannelHostCallbacks {}}+#[cfg(test)]+#[path = "callback_tests.rs"]+mod tests;+impl ChannelHostCallbacks {async fn dispatch_progressive_transport(&self,diff --git a/crates/openhuman-core/src/channels/runtime/startup/callback_tests.rs b/crates/openhuman-core/src/channels/runtime/startup/callback_tests.rsindex d7235191d4..4503bb11f0 100644--- a/crates/openhuman-core/src/channels/runtime/startup/callback_tests.rs+++ b/crates/openhuman-core/src/channels/runtime/startup/callback_tests.rs@@ -185,17 +185,16 @@ fn callback_for_channels()).is_ok());let (dispatch, _receiver) = tokio::sync::mpsc::channel::<RuntimeChannelMessage>(1);- (- ChannelHostCallbacks::new(- &crate::core::runtime::DispatchCtx::host_default(),- Arc::new(crate::config::Config::default()),- context_slot,- progressive_slot,- output_observer,- dispatch,- ),- context,- )+ let mut callback = ChannelHostCallbacks::new(+ &crate::core::runtime::DispatchCtx::host_default(),+ Arc::new(crate::config::Config::default()),+ context_slot,+ progressive_slot,+ output_observer,+ dispatch,+ );+ callback.cancellation = tokio_util::sync::CancellationToken::new();+ (callback, context)}#[tokio::test]@@ -520,7 +519,7 @@ async fn native_progressive_output_event_validates_scope_before_observer() {async fn native_progressive_callbacks_stop_after_channel_session_cancellation() {let observer = Arc::new(RecordingOutputObserver::default());let adapter = Arc::new(RecordingChannel::new("telegram:bot-b"));- let (mut callback, _context) = callback_for_channels(+ let (callback, _context) = callback_for_channels(HashMap::from([("telegram:bot-b".into(), adapter.clone() as Arc<dyn Channel>)]),HashMap::from([("telegram:bot-b".into(),@@ -529,7 +528,6 @@ async fn native_progressive_callbacks_stop_after_channel_session_cancellation()Some(observer.clone() as Arc<dyn ProgressiveOutputObserver>),);- callback.cancellation = tokio_util::sync::CancellationToken::new();callback.cancellation.cancel();assert!(callback.dispatch_controller_backend(output_event_request(@@ -553,6 +551,17 @@ async fn native_progressive_callbacks_fail_closed_after_transport_owner_drops())]),None,);+ assert!(matches!(+ callback+ .dispatch_controller_backend(output_event_request(+ Some("telegram:bot-b"),+ Some("chat-42"),+ Some("turn-16"),+ ))+ .await,+ Ok(ChannelBackendResult::ProgressiveTransport(result))+ if matches!(*result, ProgressiveTransportResult::Acknowledged)+ ));drop(context);drop(adapter);diff --git a/crates/openhuman-core/src/channels/runtime/startup/progressive_transport.rs b/crates/openhuman-core/src/channels/runtime/startup/progressive_transport.rsindex c96694fc58..da145b99b2 100644--- a/crates/openhuman-core/src/channels/runtime/startup/progressive_transport.rs+++ b/crates/openhuman-core/src/channels/runtime/startup/progressive_transport.rs@@ -141,7 +141,7 @@ impl ProgressiveChannelTransport for ModuleChannel {).await{- Ok(ChannelInteractionResult::Sent(outcome)) => Ok(map_edit_outcome(outcome)),+ Ok(ChannelInteractionResult::Sent(outcome)) => Ok(map_edit_outcome(*outcome)),Ok(_) => Err(tinybus::Error::failed("channel returned an invalid edit result",)),@@ -214,14 +214,10 @@ fn map_edit_outcome({Result::EditUnsupported}- _ => Result::Outcome(outcome),+ _ => Result::Outcome(Box::new(outcome)),}}-#[cfg(test)]-#[path = "progressive_transport_tests.rs"]-mod tests;-fn receipt_matches_scope(receipt: &tinychannels_bus::channel::MessageReceipt,channel: Option<&tinychannels_bus::ChannelRef>,@@ -250,3 +246,7 @@ fn receipt_contains_message(receipt: &tinychannels_bus::channel::MessageReceipt,.iter().any(|part| part.platform_message_id == id)}++#[cfg(test)]+#[path = "progressive_transport_tests.rs"]+mod tests;