Skip to content

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

test(channels): add module_objects to test runtime contexts

Steven Enamakel0a7e483f07af
diff --git a/crates/openhuman-core/src/channels/context_tests.rs b/crates/openhuman-core/src/channels/context_tests.rs
index edbfeeab97..e59cf3f843 100644
--- a/crates/openhuman-core/src/channels/context_tests.rs
+++ b/crates/openhuman-core/src/channels/context_tests.rs
@@ -32,6 +32,7 @@ fn runtime_context() -> ChannelRuntimeContext {
ChannelRuntimeContext {
relay_thread: None,
channels_by_name: Arc::new(HashMap::new()),
+ module_objects: Arc::new(HashMap::new()),
turn_model_source: Some(crate::agent::tinyagents::TurnModelSource::from_model(model)),
default_provider: Arc::new("default".into()),
tools_registry: Arc::new(vec![Box::new(DummyTool) as Box<dyn Tool>]),
diff --git a/crates/openhuman-core/src/channels/routes_tests.rs b/crates/openhuman-core/src/channels/routes_tests.rs
index c0a3e9aa4a..61043da489 100644
--- a/crates/openhuman-core/src/channels/routes_tests.rs
+++ b/crates/openhuman-core/src/channels/routes_tests.rs
@@ -66,6 +66,7 @@ fn runtime_context(workspace_dir: PathBuf) -> ChannelRuntimeContext {
ChannelRuntimeContext {
relay_thread: None,
channels_by_name: Arc::new(HashMap::new()),
+ module_objects: Arc::new(HashMap::new()),
turn_model_source: Some(crate::agent::tinyagents::TurnModelSource::from_model(model)),
default_provider: Arc::new("openai".into()),
tools_registry: Arc::new(vec![Box::new(DummyTool) as Box<dyn Tool>]),
diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/dispatch_tests.rs b/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/dispatch_tests.rs
index b654af7706..aedda9372f 100644
--- a/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/dispatch_tests.rs
+++ b/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/dispatch_tests.rs
@@ -45,6 +45,7 @@ fn context(channel: Arc<Telegram>, config: Config) -> Arc<ChannelRuntimeContext>
Arc::new(ChannelRuntimeContext {
relay_thread: None,
channels_by_name: Arc::new(HashMap::from([("telegram".to_string(), channel)])),
+ module_objects: Arc::new(HashMap::new()),
turn_model_source: None,
default_provider: Arc::new("test-provider".to_string()),
tools_registry: Arc::new(vec![]),
diff --git a/crates/openhuman-core/src/channels/runtime/startup/callback_tests.rs b/crates/openhuman-core/src/channels/runtime/startup/callback_tests.rs
index a2f42550d5..2468e6e44d 100644
--- a/crates/openhuman-core/src/channels/runtime/startup/callback_tests.rs
+++ b/crates/openhuman-core/src/channels/runtime/startup/callback_tests.rs
@@ -152,6 +152,7 @@ fn callback_for_channels(
let context = Arc::new(ChannelRuntimeContext {
relay_thread: None,
channels_by_name: Arc::new(channels),
+ module_objects: Arc::new(HashMap::new()),
turn_model_source: None,
default_provider: Arc::new("test-provider".into()),
tools_registry: Arc::new(Vec::new()),
diff --git a/crates/openhuman-core/src/channels/runtime/test_support.rs b/crates/openhuman-core/src/channels/runtime/test_support.rs
index b05ae7e243..01497b64cb 100644
--- a/crates/openhuman-core/src/channels/runtime/test_support.rs
+++ b/crates/openhuman-core/src/channels/runtime/test_support.rs
@@ -413,6 +413,7 @@ pub async fn run_dispatch_harness(options: DispatchHarnessOptions) -> DispatchHa
let ctx = Arc::new(ChannelRuntimeContext {
relay_thread: None,
channels_by_name: Arc::new(channels_by_name),
+ module_objects: Arc::new(HashMap::new()),
turn_model_source: Some(crate::agent::tinyagents::TurnModelSource::from_model(model)),
default_provider: Arc::new("harness-provider".to_string()),
tools_registry: Arc::new(vec![Box::new(HarnessTool) as Box<dyn Tool>]),
diff --git a/crates/openhuman-core/src/channels/tests/discord_integration.rs b/crates/openhuman-core/src/channels/tests/discord_integration.rs
index 20a0eb9809..53714bd215 100644
--- a/crates/openhuman-core/src/channels/tests/discord_integration.rs
+++ b/crates/openhuman-core/src/channels/tests/discord_integration.rs
@@ -107,6 +107,7 @@ fn make_discord_ctx(
Arc::new(ChannelRuntimeContext {
relay_thread: None,
channels_by_name: Arc::new(channels),
+ module_objects: Arc::new(HashMap::new()),
turn_model_source: Some(crate::agent::tinyagents::TurnModelSource::from_model(model)),
default_provider: Arc::new("test-provider".to_string()),
tools_registry: Arc::new(vec![]),
diff --git a/crates/openhuman-core/src/channels/tests/runtime_dispatch.rs b/crates/openhuman-core/src/channels/tests/runtime_dispatch.rs
index 87e8e826cb..cfaa27735c 100644
--- a/crates/openhuman-core/src/channels/tests/runtime_dispatch.rs
+++ b/crates/openhuman-core/src/channels/tests/runtime_dispatch.rs
@@ -119,7 +119,8 @@ async fn message_dispatch_processes_messages_in_parallel() {
let runtime_ctx = Arc::new(ChannelRuntimeContext {
relay_thread: None,
channels_by_name: Arc::new(channels_by_name),
- turn_model_source: Some(crate::agent::tinyagents::TurnModelSource::from_model(
+ module_objects: Arc::new(HashMap::new()),
+ turn_model_source: Some(crate::agent::tinyagents::TurnModelSource::from_model(
Arc::new(SlowModel {
delay: Duration::from_millis(5),
}),
@@ -199,6 +200,7 @@ async fn process_channel_message_cancels_scoped_typing_task() {
let runtime_ctx = Arc::new(ChannelRuntimeContext {
relay_thread: None,
channels_by_name: Arc::new(channels_by_name),
+ module_objects: Arc::new(HashMap::new()),
turn_model_source: Some(crate::agent::tinyagents::TurnModelSource::from_model(
Arc::new(SlowModel {
delay: Duration::from_millis(20),
@@ -293,6 +295,7 @@ async fn dispatch_routes_through_agent_run_turn_bus_handler() {
channels_by_name: Arc::new(channels_by_name),
// Still need a model for the context field, but the stubbed bus
// handler never invokes it — so a minimal no-op is fine.
+ module_objects: Arc::new(HashMap::new()),
turn_model_source: Some(crate::agent::tinyagents::TurnModelSource::from_model(
Arc::new(super::common::DummyModel),
)),
@@ -416,6 +419,7 @@ async fn resolved_route_ctx() -> Arc<ChannelRuntimeContext> {
Arc::new(ChannelRuntimeContext {
relay_thread: None,
channels_by_name: Arc::new(channels_by_name),
+ module_objects: Arc::new(HashMap::new()),
turn_model_source: Some(crate::agent::tinyagents::TurnModelSource::from_model(
Arc::new(super::common::DummyModel),
)),
@@ -552,6 +556,7 @@ async fn process_channel_message_hardens_multimodal_files_against_smuggled_marke
let runtime_ctx = Arc::new(ChannelRuntimeContext {
relay_thread: None,
channels_by_name: Arc::new(channels_by_name),
+ module_objects: Arc::new(HashMap::new()),
turn_model_source: Some(crate::agent::tinyagents::TurnModelSource::from_model(
Arc::new(super::common::DummyModel),
)),
@@ -639,6 +644,7 @@ async fn process_channel_message_hardens_against_relative_path_markers() {
let runtime_ctx = Arc::new(ChannelRuntimeContext {
relay_thread: None,
channels_by_name: Arc::new(channels_by_name),
+ module_objects: Arc::new(HashMap::new()),
turn_model_source: Some(crate::agent::tinyagents::TurnModelSource::from_model(
Arc::new(super::common::DummyModel),
)),
diff --git a/crates/openhuman-core/src/channels/tests/runtime_tool_calls.rs b/crates/openhuman-core/src/channels/tests/runtime_tool_calls.rs
index 08096e3de9..73f44e171c 100644
--- a/crates/openhuman-core/src/channels/tests/runtime_tool_calls.rs
+++ b/crates/openhuman-core/src/channels/tests/runtime_tool_calls.rs
@@ -27,6 +27,7 @@ async fn process_channel_message_executes_native_tool_calls() {
let runtime_ctx = Arc::new(ChannelRuntimeContext {
relay_thread: None,
channels_by_name: Arc::new(channels_by_name),
+ module_objects: Arc::new(HashMap::new()),
turn_model_source: Some(crate::agent::tinyagents::TurnModelSource::from_model(
Arc::new(ToolCallingModel),
)),
@@ -102,6 +103,7 @@ async fn process_channel_message_handles_models_command_without_llm_call() {
let runtime_ctx = Arc::new(ChannelRuntimeContext {
relay_thread: None,
channels_by_name: Arc::new(channels_by_name),
+ module_objects: Arc::new(HashMap::new()),
turn_model_source: Some(crate::agent::tinyagents::TurnModelSource::from_model(
Arc::clone(&default_provider),
)),
@@ -208,6 +210,7 @@ async fn process_channel_message_uses_route_override_provider_and_model() {
let runtime_ctx = Arc::new(ChannelRuntimeContext {
relay_thread: None,
channels_by_name: Arc::new(channels_by_name),
+ module_objects: Arc::new(HashMap::new()),
turn_model_source: Some(crate::agent::tinyagents::TurnModelSource::from_model(
Arc::clone(&default_provider),
)),
@@ -258,6 +261,7 @@ async fn process_channel_message_respects_configured_max_tool_iterations_above_d
let runtime_ctx = Arc::new(ChannelRuntimeContext {
relay_thread: None,
channels_by_name: Arc::new(channels_by_name),
+ module_objects: Arc::new(HashMap::new()),
turn_model_source: Some(crate::agent::tinyagents::TurnModelSource::from_model(
Arc::new(IterativeToolModel {
required_tool_iterations: 11,
@@ -320,6 +324,7 @@ async fn process_channel_message_reports_configured_max_tool_iterations_limit()
let runtime_ctx = Arc::new(ChannelRuntimeContext {
relay_thread: None,
channels_by_name: Arc::new(channels_by_name),
+ module_objects: Arc::new(HashMap::new()),
turn_model_source: Some(crate::agent::tinyagents::TurnModelSource::from_model(
Arc::new(IterativeToolModel {
required_tool_iterations: 20,
diff --git a/crates/openhuman-core/src/channels/tests/telegram_integration.rs b/crates/openhuman-core/src/channels/tests/telegram_integration.rs
index ce530b5dbc..d52f498a98 100644
--- a/crates/openhuman-core/src/channels/tests/telegram_integration.rs
+++ b/crates/openhuman-core/src/channels/tests/telegram_integration.rs
@@ -83,6 +83,7 @@ fn make_test_context(
Arc::new(ChannelRuntimeContext {
relay_thread: None,
channels_by_name: Arc::new(channels),
+ module_objects: Arc::new(HashMap::new()),
turn_model_source: Some(crate::agent::tinyagents::TurnModelSource::from_model(model)),
default_provider: Arc::new("test-provider".to_string()),
tools_registry: Arc::new(vec![]),