Skip to content

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

test(channels): update channel processing logic and tests

Steven Enamakeld6fd7b726c5f
diff --git a/crates/openhuman-core/src/channels/routes_tests.rs b/crates/openhuman-core/src/channels/routes_tests.rs
index 59bc74812b..582e0e35ac 100644
--- a/crates/openhuman-core/src/channels/routes_tests.rs
+++ b/crates/openhuman-core/src/channels/routes_tests.rs
@@ -259,6 +259,7 @@ async fn sign_out_cancels_remote_invalidation_while_it_waits_for_the_session_tab
let callback = RouteCallbacks::new(
runtime_context(PathBuf::from("/tmp/channel-callback")),
cancellation.clone(),
+ None,
);
assert!(Arc::ptr_eq(
callback.core_context.as_ref().unwrap(),
@@ -374,6 +375,8 @@ async fn clear_history_command_uses_reset_callback_and_persists_route_override()
&msg,
Some(&channel),
&conversation_history_key(&msg),
+ None,
+ &msg,
move || async move {
callback_flag.store(true, std::sync::atomic::Ordering::SeqCst);
Ok(())
diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/processor/turn.rs b/crates/openhuman-core/src/channels/runtime/dispatch/processor/turn.rs
index 8f7d3b8067..2f3a6bf12b 100644
--- a/crates/openhuman-core/src/channels/runtime/dispatch/processor/turn.rs
+++ b/crates/openhuman-core/src/channels/runtime/dispatch/processor/turn.rs
@@ -86,6 +86,11 @@ pub(crate) async fn process_channel_runtime_message(
let canonical_session_key = prepared.session_key.clone();
let mut envelope = prepared.envelope;
envelope.access.delivered_via_upstream_relay = authenticated_relay;
+ let remote_reset_scope = tinychannels_bus::module_remote::RemoteSessionScope {
+ channel: envelope.channel.clone(),
+ conversation: envelope.conversation.clone(),
+ session_key: canonical_session_key.clone(),
+ };
crate::channels::host::voice::record_inbound_envelope(&envelope);
let native_target = if let Some(target) = progressive_target {
Some(target)
@@ -122,7 +127,7 @@ pub(crate) async fn process_channel_runtime_message(
reply_target: msg.reply_target.clone(),
content: msg.content.clone(),
thread_ts: msg.thread_ts.clone(),
- inbound_envelope: Some(envelope),
+ inbound_envelope: Some(envelope.clone()),
workspace_dir: ctx.workspace_dir.as_ref().clone(),
});
@@ -136,6 +141,8 @@ pub(crate) async fn process_channel_runtime_message(
&msg,
target_channel.as_ref(),
&history_key,
+ Some(remote_reset_scope),
+ &msg,
|| async move {
reset_durable_channel_session(
&reset_context,