Skip to content

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

refactor(channels): update channel test and runtime configurations

Steven Enamakel234d9d086fe1
diff --git a/crates/openhuman-core/src/channels/mod.rs b/crates/openhuman-core/src/channels/mod.rs
index 61892f7b53..cf0f662d49 100644
--- a/crates/openhuman-core/src/channels/mod.rs
+++ b/crates/openhuman-core/src/channels/mod.rs
@@ -43,7 +43,7 @@ pub(crate) use system_prompt::ChannelSystemPrompt;
#[cfg(all(feature = "channels", test))]
mod tests;
-#[cfg(all(feature = "channels", any(test, feature = "e2e-test-support")))]
+#[cfg(all(feature = "channels", any(test, debug_assertions)))]
pub mod test_support;
#[cfg(feature = "channels")]
diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/mod.rs b/crates/openhuman-core/src/channels/runtime/dispatch/mod.rs
index a96d0d334b..f5dce4b331 100644
--- a/crates/openhuman-core/src/channels/runtime/dispatch/mod.rs
+++ b/crates/openhuman-core/src/channels/runtime/dispatch/mod.rs
@@ -32,7 +32,7 @@ use processor::channel_has_approval_surface;
// Re-export internal helpers accessed by test_support (cfg(any(test,
// debug_assertions))) and the inline #[cfg(test)] modules via `super::*`.
-#[cfg(test)]
+#[cfg(any(test, debug_assertions))]
use helpers::build_channel_context_block;
#[cfg(test)]
use helpers::select_acknowledgment_reaction;
@@ -40,10 +40,10 @@ use helpers::select_acknowledgment_reaction;
#[cfg(test)]
use routing::{build_visible_tool_set, AgentScoping};
-#[cfg(test)]
+#[cfg(any(test, debug_assertions))]
use tinychannels_bus as traits;
-#[cfg(test)]
+#[cfg(any(test, debug_assertions))]
#[path = "mod_test_support_tests.rs"]
pub mod test_support;
diff --git a/crates/openhuman-core/src/channels/runtime/startup.rs b/crates/openhuman-core/src/channels/runtime/startup.rs
index 38df98224e..04d6536986 100644
--- a/crates/openhuman-core/src/channels/runtime/startup.rs
+++ b/crates/openhuman-core/src/channels/runtime/startup.rs
@@ -17,7 +17,7 @@ use tinybus::module::{ModuleCallError, ModuleClient};
/// are dispatched through the loaded TinyChannels module's bus object.
#[derive(Clone)]
pub(crate) enum ChannelHandle {
- Module(module_providers::ModuleChannel),
+ Module(std::sync::Arc<module_providers::ModuleChannel>),
Relay(std::sync::Arc<crate::channels::providers::relay::RelayChannel>),
/// Test-only sink for narrow policy tests that do not need the linked module.
#[cfg(test)]
diff --git a/crates/openhuman-core/src/channels/runtime/startup/module_providers.rs b/crates/openhuman-core/src/channels/runtime/startup/module_providers.rs
index a29900f661..5181c630ad 100644
--- a/crates/openhuman-core/src/channels/runtime/startup/module_providers.rs
+++ b/crates/openhuman-core/src/channels/runtime/startup/module_providers.rs
@@ -147,7 +147,7 @@ impl ModuleChannelRuntime {
let channel = Arc::new(channel);
channels.insert(
info.name.clone(),
- Arc::new(super::ChannelHandle::Module((*channel).clone())),
+ Arc::new(super::ChannelHandle::Module(Arc::clone(&channel))),
);
let progressive_channel: Arc<dyn ProgressiveChannelTransport> = channel.clone();
progressive.insert(info.name.clone(), Arc::downgrade(&progressive_channel));
diff --git a/crates/openhuman-core/src/channels/runtime/test_support.rs b/crates/openhuman-core/src/channels/runtime/test_support.rs
index dc4ae7560b..ef3ca703e2 100644
--- a/crates/openhuman-core/src/channels/runtime/test_support.rs
+++ b/crates/openhuman-core/src/channels/runtime/test_support.rs
@@ -6,7 +6,7 @@ use super::dispatch::{
};
pub use super::startup::test_support::resolve_yuanbao_app_secret_for_test;
use crate::agent::bus::{AgentTurnRequest, AgentTurnResponse, AGENT_RUN_TURN_METHOD};
-use crate::channels::context::{ChannelRuntimeContext, CHANNEL_MESSAGE_TIMEOUT_SECS};
+use crate::channels::context::ChannelRuntimeContext;
use crate::channels::ChannelSystemPrompt;
use crate::config::{MultimodalConfig, MultimodalFileConfig, ReliabilityConfig};
use crate::core::bus::BUS;
@@ -139,7 +139,7 @@ pub struct DispatchHarnessObservation {
/// should use this fixture rather than a synthetic `Channel` implementation.
pub(crate) struct LinkedTelegramRuntime {
_env: crate::config::test_env::EnvVarGuard,
- _storage: crate::channels::module_fixture_tests::MemoryStorageGuard,
+ _storage: crate::channels::module_fixture::MemoryStorageGuard,
_workspace: tempfile::TempDir,
server: MockServer,
runtime: crate::channels::runtime::ModuleRuntimeTestGuard,
@@ -363,10 +363,9 @@ pub async fn run_dispatch_harness(options: DispatchHarnessOptions) -> DispatchHa
}
});
- let state = Arc::new(crate::channels::runtime::TestChannel::new(
- options.channel_name.clone(),
- ));
+ let mut state = crate::channels::runtime::TestChannel::new(options.channel_name.clone());
state.supports_reactions = options.supports_reactions;
+ let state = Arc::new(state);
let mut channels_by_name = HashMap::new();
channels_by_name.insert(
options.channel_name.clone(),
diff --git a/crates/openhuman-core/src/core/events.rs b/crates/openhuman-core/src/core/events.rs
index 7820b29c29..466310af80 100644
--- a/crates/openhuman-core/src/core/events.rs
+++ b/crates/openhuman-core/src/core/events.rs
@@ -353,16 +353,14 @@ pub enum DomainEvent {
/// `workspace_dir` does not match their own workspace binding.
workspace_dir: std::path::PathBuf,
},
- /// Retired legacy reaction callback payload. Kept as a wire tombstone for
- /// Events 1.x compatibility; new providers publish typed `ChannelEvent`s.
+ /// Retired legacy reaction callback payload, retained as an Events 1.x wire tombstone.
ChannelReactionReceived {
channel: String,
sender: String,
target_message_id: String,
emoji: String,
},
- /// Retired legacy reaction callback payload. Kept as a wire tombstone for
- /// Events 1.x compatibility; new providers publish typed `ChannelEvent`s.
+ /// Retired legacy reaction callback payload, retained as an Events 1.x wire tombstone.
ChannelReactionSent {
channel: String,
target_message_id: String,