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
fix(channels): validate progressive output identity only when an observer exists
Steven Enamakelf6aed22ac1b3
diff --git a/crates/openhuman-core/src/channels/runtime/startup/callback.rs b/crates/openhuman-core/src/channels/runtime/startup/callback.rsindex 5da24d9fd7..2ac7c681fc 100644--- a/crates/openhuman-core/src/channels/runtime/startup/callback.rs+++ b/crates/openhuman-core/src/channels/runtime/startup/callback.rs@@ -292,16 +292,16 @@ impl ChannelHostCallbacks {..} = &request{- let channel = channel_ref- .as_ref()- .ok_or_else(|| Error::failed("progressive output channel identity is required"))?;- let conversation = conversation.as_ref().ok_or_else(|| {- Error::failed("progressive output conversation identity is required")- })?;- let turn_id = turn_id- .as_deref()- .ok_or_else(|| Error::failed("progressive output turn identity is required"))?;if let Some(observer) = &self.output_observer {+ let channel = channel_ref.as_ref().ok_or_else(|| {+ Error::failed("progressive output channel identity is required")+ })?;+ let conversation = conversation.as_ref().ok_or_else(|| {+ Error::failed("progressive output conversation identity is required")+ })?;+ let turn_id = turn_id.as_deref().ok_or_else(|| {+ Error::failed("progressive output turn identity is required")+ })?;observer.observe(channel, conversation, turn_id, *sequence, event).await?;diff --git a/crates/openhuman-core/src/channels/runtime/startup/callback_tests.rs b/crates/openhuman-core/src/channels/runtime/startup/callback_tests.rsindex 087a392b78..ae72f64254 100644--- a/crates/openhuman-core/src/channels/runtime/startup/callback_tests.rs+++ b/crates/openhuman-core/src/channels/runtime/startup/callback_tests.rs@@ -17,6 +17,7 @@ use tinychannels_bus::{ChannelBackendRequest, ChannelBackendResult, SendMessage}struct RecordingChannel {name: String,sent: tokio::sync::Mutex<Vec<ChannelOutboundMessage>>,+ progressive_requests: tokio::sync::Mutex<Vec<ProgressiveTransportRequest>>,}impl RecordingChannel {@@ -24,6 +25,7 @@ impl RecordingChannel {Self {name: name.into(),sent: tokio::sync::Mutex::new(Vec::new()),+ progressive_requests: tokio::sync::Mutex::new(Vec::new()),}}}@@ -78,6 +80,7 @@ impl ProgressiveChannelTransport for RecordingChannel {&self,request: ProgressiveTransportRequest,) -> Result<ProgressiveTransportResult> {+ self.progressive_requests.lock().await.push(request.clone());let ProgressiveTransportRequest::SendTyped {channel,turn_id,@@ -261,6 +264,17 @@ async fn native_progressive_transport_dispatches_typed_content_through_configure// Sequence and segment are represented in the module's idempotency key.assert_eq!(sent[0].idempotency_key, "turn-11:3:1");assert_eq!(sent[0].parts, parts);+ let requests = selected_account.progressive_requests.lock().await;+ let ProgressiveTransportRequest::SendTyped {+ sequence,+ segment_index,+ ..+ } = &requests[0]+ else {+ panic!("expected the typed progressive request");+ };+ assert_eq!(*sequence, Some(3));+ assert_eq!(*segment_index, Some(1));}#[tokio::test]