Skip to content

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

refactor(channels): update imports and types across dispatch logic

Steven Enamakel851638aa0618
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 b42e2a0bfa..ad1365f68f 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
@@ -3,12 +3,12 @@
//! still goes to the orchestrator over the bus.
use super::*;
-use crate::agent::bus::{AgentTurnRequest, AgentTurnResponse, mock_agent_run_turn};
+use crate::agent::bus::{mock_agent_run_turn, AgentTurnRequest, AgentTurnResponse};
use crate::agent::host_agents::{self, HostAgent, HostAgentResolver};
-use crate::channels::context::{CHANNEL_MESSAGE_TIMEOUT_SECS, ChannelRuntimeContext};
+use crate::channels::context::{ChannelRuntimeContext, CHANNEL_MESSAGE_TIMEOUT_SECS};
use crate::channels::runtime::process_channel_message;
use crate::core::runtime::{CoreContext, DomainSet};
-use serde_json::{Value, json};
+use serde_json::{json, Value};
use std::collections::HashMap;
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::{Arc, Mutex};
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 d49e071639..1d7a1fd0fa 100644
--- a/crates/openhuman-core/src/channels/runtime/dispatch/processor/turn.rs
+++ b/crates/openhuman-core/src/channels/runtime/dispatch/processor/turn.rs
@@ -1,11 +1,11 @@
//! The per-message pipeline: typing indicator, ACK reaction, durable-session
//! dispatch through the shared runner, and final reply delivery.
-use crate::channels::SendMessage;
-use crate::channels::context::{ChannelRuntimeContext, is_context_window_overflow_error};
+use crate::channels::context::{is_context_window_overflow_error, ChannelRuntimeContext};
#[cfg(test)]
use crate::channels::routes::get_or_create_turn_model_source;
use crate::channels::routes::{get_route_selection, handle_runtime_command_with_reset};
+use crate::channels::SendMessage;
use crate::core::bus::BUS;
use crate::core::events::DomainEvent;
use crate::util::truncate_with_ellipsis;
@@ -15,12 +15,12 @@ use tokio_util::sync::CancellationToken;
use tokio_util::task::AbortOnDropHandle;
use super::super::helpers::{
- REPLY_LOG_TRUNCATE_CHARS, build_channel_context_block, log_worker_join_result,
- spawn_typing_task,
+ build_channel_context_block, log_worker_join_result, spawn_typing_task,
+ REPLY_LOG_TRUNCATE_CHARS,
};
use super::super::host_agent::{self, HostRoute};
-use super::RuntimeChannelMessage;
use super::approval::{channel_has_approval_surface, try_route_approval_reply};
+use super::RuntimeChannelMessage;
fn inbound_console_preview(
envelope: &tinychannels_bus::ChannelInboundEnvelope,
@@ -458,7 +458,7 @@ pub(crate) async fn process_channel_runtime_message(
.message_timeout_secs
.max(tinychannels_bus::MIN_CHANNEL_MESSAGE_TIMEOUT_SECS);
let result = match tokio::time::timeout(
- Duration::from_secs(timeout_secs),
+ std::time::Duration::from_secs(timeout_secs),
super::bus_turn::dispatch_test_turn(
ctx.as_ref(),
&msg,
diff --git a/crates/openhuman-core/src/channels/tests/runtime_dispatch.rs b/crates/openhuman-core/src/channels/tests/runtime_dispatch.rs
index 423962fa9d..9b530b1129 100644
--- a/crates/openhuman-core/src/channels/tests/runtime_dispatch.rs
+++ b/crates/openhuman-core/src/channels/tests/runtime_dispatch.rs
@@ -1,12 +1,12 @@
-use super::super::context::{CHANNEL_MESSAGE_TIMEOUT_SECS, ChannelRuntimeContext};
+use super::super::context::{ChannelRuntimeContext, CHANNEL_MESSAGE_TIMEOUT_SECS};
use super::super::runtime::test_support::{
- DispatchHarnessOptions, linked_telegram_runtime, run_dispatch_harness,
+ linked_telegram_runtime, run_dispatch_harness, DispatchHarnessOptions,
};
use super::super::runtime::{
- RuntimeChannelMessage, process_channel_message, run_message_dispatch_loop,
+ process_channel_message, run_message_dispatch_loop, RuntimeChannelMessage,
};
-use super::common::{RecordingChannel, SlowModel, use_real_agent_handler};
-use crate::agent::bus::{AgentTurnRequest, AgentTurnResponse, mock_agent_run_turn};
+use super::common::{use_real_agent_handler, RecordingChannel, SlowModel};
+use crate::agent::bus::{mock_agent_run_turn, AgentTurnRequest, AgentTurnResponse};
use crate::channels::runtime::ChannelHandle;
use crate::core::events::DomainEvent;
use crate::inference::provider;
@@ -368,7 +368,7 @@ async fn resolved_route_ctx(
let mut channel_state = RecordingChannel::default();
channel_state.send_error = send_error.map(str::to_owned);
let channel_impl = Arc::new(channel_state);
- let channel = Arc::new(ChannelHandle::Test(channel_impl));
+ let channel = Arc::new(ChannelHandle::Test(Arc::clone(&channel_impl)));
let mut channels_by_name = HashMap::new();
channels_by_name.insert(channel.name().to_string(), channel);