Skip to content

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

chore(channels): reorder imports and reformat test fixtures

Steven Enamakeld3f4f189e7d8
diff --git a/crates/openhuman-core/src/channels/context_tests.rs b/crates/openhuman-core/src/channels/context_tests.rs
index c8f652bf43..e4edec7879 100644
--- a/crates/openhuman-core/src/channels/context_tests.rs
+++ b/crates/openhuman-core/src/channels/context_tests.rs
@@ -57,8 +57,14 @@ fn runtime_context() -> ChannelRuntimeContext {
fn channel_message(channel: &str) -> traits::ChannelInboundEnvelope {
traits::ChannelInboundEnvelope {
- channel: traits::ChannelRef { id: channel.into(), account_id: None },
- sender: traits::SenderRef { id: "alice".into(), ..Default::default() },
+ channel: traits::ChannelRef {
+ id: channel.into(),
+ account_id: None,
+ },
+ sender: traits::SenderRef {
+ id: "alice".into(),
+ ..Default::default()
+ },
text: "hello".into(),
message_id: "m1".into(),
conversation: traits::ConversationRef {
diff --git a/crates/openhuman-core/src/channels/host/channel_events.rs b/crates/openhuman-core/src/channels/host/channel_events.rs
index db76f60efb..3bcdc5ac45 100644
--- a/crates/openhuman-core/src/channels/host/channel_events.rs
+++ b/crates/openhuman-core/src/channels/host/channel_events.rs
@@ -1,12 +1,12 @@
//! Host-owned approval routing and turn events over the channel module.
-use crate::channels::{Channel, outbound::text_message};
+use crate::channels::{outbound::text_message, Channel};
use crate::core::events::DomainEvent;
use async_trait::async_trait;
use std::collections::HashMap;
use std::path::PathBuf;
use std::sync::{Arc, Mutex};
-use tinybus::EventHandler;
use tinybus::module::ModuleClient;
+use tinybus::EventHandler;
#[derive(Clone)]
struct ReplyContext {
diff --git a/crates/openhuman-core/src/channels/proactive.rs b/crates/openhuman-core/src/channels/proactive.rs
index 5f7d1decdc..442f189263 100644
--- a/crates/openhuman-core/src/channels/proactive.rs
+++ b/crates/openhuman-core/src/channels/proactive.rs
@@ -19,11 +19,11 @@
//! (step 1). This avoids double-delivering to a channel that doesn't
//! exist.
-use crate::channels::Channel;
use crate::channels::outbound::text_message;
+use crate::channels::Channel;
use crate::core::events::DomainEvent;
-use crate::web_chat::WebChannelEvent;
use crate::web_chat::publish_web_channel_event;
+use crate::web_chat::WebChannelEvent;
use async_trait::async_trait;
use std::collections::HashMap;
use std::sync::{Arc, RwLock};
diff --git a/crates/openhuman-core/src/channels/providers/relay/channel.rs b/crates/openhuman-core/src/channels/providers/relay/channel.rs
index 2960e9c9d7..0f67ca541b 100644
--- a/crates/openhuman-core/src/channels/providers/relay/channel.rs
+++ b/crates/openhuman-core/src/channels/providers/relay/channel.rs
@@ -10,7 +10,7 @@ use std::sync::Mutex;
use async_trait::async_trait;
use serde_json::json;
-use crate::web_chat::{WebChannelEvent, publish_web_channel_event};
+use crate::web_chat::{publish_web_channel_event, WebChannelEvent};
use tinychannels_bus::channel::{ContentPart, OutboundContentPart};
use tinychannels_bus::{Channel, ChannelOutboundMessage};
diff --git a/crates/openhuman-core/src/channels/providers/relay/ops.rs b/crates/openhuman-core/src/channels/providers/relay/ops.rs
index f844f8607f..3a9ea146ee 100644
--- a/crates/openhuman-core/src/channels/providers/relay/ops.rs
+++ b/crates/openhuman-core/src/channels/providers/relay/ops.rs
@@ -3,7 +3,7 @@
use std::collections::HashMap;
use std::sync::Arc;
-use serde_json::{Value, json};
+use serde_json::{json, Value};
use super::channel::RelayChannel;
use super::params::RelayInboundParams;
@@ -11,8 +11,8 @@ use super::store::{self, Recorded};
use crate::channels::context::MAX_CHANNEL_HISTORY;
use crate::channels::outbound::text_message;
use crate::channels::runtime::{
- PromptToolDescs, RuntimeChannelMessage, build_channel_turn_parts, prepare_runtime_limits,
- process_channel_runtime_message, runtime_context,
+ build_channel_turn_parts, prepare_runtime_limits, process_channel_runtime_message,
+ runtime_context, PromptToolDescs, RuntimeChannelMessage,
};
use crate::config::Config;
use crate::core::Outcome;
diff --git a/crates/openhuman-core/src/channels/providers/relay/ops_tests.rs b/crates/openhuman-core/src/channels/providers/relay/ops_tests.rs
index 0c4e932cd5..87a03126e0 100644
--- a/crates/openhuman-core/src/channels/providers/relay/ops_tests.rs
+++ b/crates/openhuman-core/src/channels/providers/relay/ops_tests.rs
@@ -1,6 +1,6 @@
use super::super::channel::CHANNEL_OUTBOUND_EVENT;
use super::*;
-use crate::agent::bus::{AgentTurnRequest, AgentTurnResponse, mock_agent_run_turn};
+use crate::agent::bus::{mock_agent_run_turn, AgentTurnRequest, AgentTurnResponse};
use crate::core::runtime::{ContextOverlay, CoreContext, DomainSet};
use crate::security::turn_origin::AgentTurnOrigin;
use std::sync::Mutex;
diff --git a/crates/openhuman-core/src/channels/providers/relay/params.rs b/crates/openhuman-core/src/channels/providers/relay/params.rs
index 7360772ce5..01eb1edb69 100644
--- a/crates/openhuman-core/src/channels/providers/relay/params.rs
+++ b/crates/openhuman-core/src/channels/providers/relay/params.rs
@@ -7,7 +7,7 @@ use serde_json::Value;
#[cfg(test)]
use crate::channels::bus::derive_inbound_thread_id;
use tinychannels_bus::{
- ChannelInboundEnvelope, ChannelRef, ConversationRef, SenderRef, channel::ContentPart,
+ channel::ContentPart, ChannelInboundEnvelope, ChannelRef, ConversationRef, SenderRef,
};
/// Longest channel name: `telegram`, `imessage`, `discord`, ...
diff --git a/crates/openhuman-core/src/channels/routes_tests.rs b/crates/openhuman-core/src/channels/routes_tests.rs
index beffcfd38c..b940c6a6b1 100644
--- a/crates/openhuman-core/src/channels/routes_tests.rs
+++ b/crates/openhuman-core/src/channels/routes_tests.rs
@@ -1,6 +1,6 @@
use super::*;
use crate::channels::context::{
- ChannelRuntimeContext, RouteSelectionMap, TurnModelSourceCacheMap, conversation_history_key,
+ conversation_history_key, ChannelRuntimeContext, RouteSelectionMap, TurnModelSourceCacheMap,
};
use crate::channels::host::ChannelTurnStateSubscriber;
use crate::core::events::DomainEvent;
@@ -420,13 +420,12 @@ async fn handle_runtime_command_set_model_clears_sender_history_and_persists_rou
.await;
assert!(handled);
- assert!(
- ctx.conversation_histories
- .lock()
- .unwrap()
- .get(key)
- .is_none()
- );
+ assert!(ctx
+ .conversation_histories
+ .lock()
+ .unwrap()
+ .get(key)
+ .is_none());
assert_eq!(
get_route_selection(&ctx, key),
ChannelRouteSelection {
@@ -548,9 +547,7 @@ async fn handle_runtime_command_telegram_sessions_reports_empty_store() {
let sent = channel_impl.sent.lock().unwrap();
assert_eq!(sent.len(), 1);
- assert!(
- sent_text(&sent[0]).contains("No conversation threads yet. Send `/new` to create one.")
- );
+ assert!(sent_text(&sent[0]).contains("No conversation threads yet. Send `/new` to create one."));
assert_eq!(sent[0].thread_id.as_deref(), Some("42"));
}
@@ -585,13 +582,12 @@ async fn handle_runtime_command_telegram_new_status_and_sessions_round_trip() {
)
.await
);
- assert!(
- ctx.conversation_histories
- .lock()
- .unwrap()
- .get(sender_key)
- .is_none()
- );
+ assert!(ctx
+ .conversation_histories
+ .lock()
+ .unwrap()
+ .get(sender_key)
+ .is_none());
ctx.conversation_histories
.lock()
@@ -670,10 +666,9 @@ async fn handle_runtime_command_telegram_new_status_and_sessions_round_trip() {
assert!(sent_text(&sent[2]).contains("**Recent sessions**"));
assert!(sent_text(&sent[2]).contains("→ `Telegram"));
- assert!(
- sent.iter()
- .all(|message| message.thread_ts.as_deref() == Some("42"))
- );
+ assert!(sent
+ .iter()
+ .all(|message| message.thread_ts.as_deref() == Some("42")));
}
#[tokio::test]
diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/helpers_tests.rs b/crates/openhuman-core/src/channels/runtime/dispatch/helpers_tests.rs
index e6b9267229..85a8e490e0 100644
--- a/crates/openhuman-core/src/channels/runtime/dispatch/helpers_tests.rs
+++ b/crates/openhuman-core/src/channels/runtime/dispatch/helpers_tests.rs
@@ -1,7 +1,7 @@
use super::*;
use crate::core::runtime::DispatchCtx;
use std::sync::Arc;
-use tokio::sync::{Notify, oneshot};
+use tokio::sync::{oneshot, Notify};
struct DeferredTyping {
started: Notify,
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 090d586c89..e98e549d34 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,13 +3,13 @@
//! 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::Channel;
-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::channels::Channel;
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.rs b/crates/openhuman-core/src/channels/runtime/dispatch/processor.rs
index ef3cbe3aaa..38056f34f4 100644
--- a/crates/openhuman-core/src/channels/runtime/dispatch/processor.rs
+++ b/crates/openhuman-core/src/channels/runtime/dispatch/processor.rs
@@ -23,7 +23,7 @@ mod bus_turn;
mod in_order;
mod turn;
-use super::inbound_batch::{QueuedInbound, merge_channel_batch};
+use super::inbound_batch::{merge_channel_batch, QueuedInbound};
use crate::channels::context::ChannelRuntimeContext;
use crate::config::InboundDebounceConfig;
use crate::inbound_debounce::{KeyedDebouncer, Push};
@@ -64,8 +64,8 @@ impl RuntimeChannelMessage {
}
}
-pub(crate) use admit::AdmittedInbound;
use admit::admit_runtime_message;
+pub(crate) use admit::AdmittedInbound;
#[cfg(test)]
pub(crate) use approval::channel_has_approval_surface;
use turn::run_admitted_turn;
diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/processor/admit.rs b/crates/openhuman-core/src/channels/runtime/dispatch/processor/admit.rs
index bf77dad619..7648ed86ac 100644
--- a/crates/openhuman-core/src/channels/runtime/dispatch/processor/admit.rs
+++ b/crates/openhuman-core/src/channels/runtime/dispatch/processor/admit.rs
@@ -10,8 +10,8 @@ use crate::util::truncate_with_ellipsis;
use std::sync::Arc;
use tinychannels_bus::ChannelInboundEnvelope;
-use super::RuntimeChannelMessage;
use super::approval::{channel_has_approval_surface, try_route_approval_reply};
+use super::RuntimeChannelMessage;
/// A prepared inbound message that still needs an agent turn: not a runtime
/// command and not an approval reply.
diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/processor/bus_turn.rs b/crates/openhuman-core/src/channels/runtime/dispatch/processor/bus_turn.rs
index 072649449b..37f50c1cb2 100644
--- a/crates/openhuman-core/src/channels/runtime/dispatch/processor/bus_turn.rs
+++ b/crates/openhuman-core/src/channels/runtime/dispatch/processor/bus_turn.rs
@@ -1,7 +1,7 @@
//! The orchestrator path: an unbound channel's turn goes over the native bus
//! to the `agent.run_turn` handler, with the orchestrator's tool scoping.
-use crate::agent::bus::{AGENT_RUN_TURN_METHOD, AgentTurnRequest, AgentTurnResponse};
+use crate::agent::bus::{AgentTurnRequest, AgentTurnResponse, AGENT_RUN_TURN_METHOD};
use crate::channels::context::{ChannelRouteSelection, ChannelRuntimeContext};
use crate::core::bus::BUS;
use crate::progress::AgentProgress;
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 507c50f5c3..f1f6a3c780 100644
--- a/crates/openhuman-core/src/channels/runtime/dispatch/processor/turn.rs
+++ b/crates/openhuman-core/src/channels/runtime/dispatch/processor/turn.rs
@@ -4,7 +4,7 @@
use crate::agent::bus::AgentTurnResponse;
use crate::channels::context::{
- ChannelRuntimeContext, compact_sender_history, is_context_window_overflow_error,
+ compact_sender_history, is_context_window_overflow_error, ChannelRuntimeContext,
};
use crate::channels::outbound::text_message;
use crate::channels::routes::{get_or_create_turn_model_source, get_route_selection};
@@ -15,20 +15,20 @@ use crate::util::truncate_with_ellipsis;
use std::sync::Arc;
use std::time::{Duration, Instant};
use tinyagents_session::transcript::TranscriptMessage;
-use tinychannels_bus::ChannelInboundEnvelope;
use tinychannels_bus::context::ChatMessage;
+use tinychannels_bus::ChannelInboundEnvelope;
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, HostChannelTurn, HostRoute, run_host_agent_turn, seed_rows};
-use super::RuntimeChannelMessage;
-use super::admit::{AdmittedInbound, admit_runtime_message};
+use super::super::host_agent::{self, run_host_agent_turn, seed_rows, HostChannelTurn, HostRoute};
+use super::admit::{admit_runtime_message, AdmittedInbound};
use super::approval::channel_has_approval_surface;
use super::bus_turn::dispatch_bus_turn;
+use super::RuntimeChannelMessage;
pub(crate) async fn process_channel_message(
ctx: Arc<ChannelRuntimeContext>,
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 2639ed3dd9..6a549d9bd0 100644
--- a/crates/openhuman-core/src/channels/runtime/startup/module_providers.rs
+++ b/crates/openhuman-core/src/channels/runtime/startup/module_providers.rs
@@ -10,11 +10,11 @@ use async_trait::async_trait;
use std::collections::HashMap;
use std::sync::{Arc, OnceLock, Weak};
use tinybus::module::{ModuleCallError, ModuleClient, ModuleObjectClient};
-use tinychannels_bus::Channel;
use tinychannels_bus::module_runtime::{
ChannelIngressKind, ChannelMessagePreparation, ConfiguredChannelInfo,
};
use tinychannels_bus::module_supervision::ChannelSupervisionPolicy;
+use tinychannels_bus::Channel;
use tinychannels_bus::{ChannelInteraction, ChannelInteractionResult};
use tokio::sync::mpsc;
diff --git a/crates/openhuman-core/src/channels/runtime/supervision.rs b/crates/openhuman-core/src/channels/runtime/supervision.rs
index 08791296eb..b239a61c8b 100644
--- a/crates/openhuman-core/src/channels/runtime/supervision.rs
+++ b/crates/openhuman-core/src/channels/runtime/supervision.rs
@@ -94,7 +94,7 @@ pub(crate) fn spawn_supervised_listener(
}
#[cfg(test)]
-pub(crate) use tinychannels::runtime::{MAX_JITTER_MS, jitter_millis};
+pub(crate) use tinychannels::runtime::{jitter_millis, MAX_JITTER_MS};
#[cfg(test)]
#[path = "supervision_tests.rs"]
diff --git a/crates/openhuman-core/src/channels/runtime/supervision_tests.rs b/crates/openhuman-core/src/channels/runtime/supervision_tests.rs
index c5ea622775..e8ba8b6590 100644
--- a/crates/openhuman-core/src/channels/runtime/supervision_tests.rs
+++ b/crates/openhuman-core/src/channels/runtime/supervision_tests.rs
@@ -1,5 +1,5 @@
use super::super::super::Channel;
-use super::{MAX_JITTER_MS, jitter_millis, spawn_supervised_listener};
+use super::{jitter_millis, spawn_supervised_listener, MAX_JITTER_MS};
use std::sync::{Arc, Mutex};
use tinychannels_bus as traits;
use tokio::time::Instant;
diff --git a/crates/openhuman-core/src/channels/runtime/test_support.rs b/crates/openhuman-core/src/channels/runtime/test_support.rs
index 40d0586a4b..0919d62f37 100644
--- a/crates/openhuman-core/src/channels/runtime/test_support.rs
+++ b/crates/openhuman-core/src/channels/runtime/test_support.rs
@@ -1,12 +1,12 @@
//! Debug-build harnesses for raw integration coverage of the channel runtime.
pub use super::dispatch::test_support::build_channel_context_block_for_test;
-use super::dispatch::{RuntimeChannelMessage, process_channel_runtime_message};
+use super::dispatch::{process_channel_runtime_message, RuntimeChannelMessage};
pub use super::startup::test_support::resolve_yuanbao_app_secret_for_test;
-use crate::agent::bus::{AGENT_RUN_TURN_METHOD, AgentTurnRequest, AgentTurnResponse};
+use crate::agent::bus::{AgentTurnRequest, AgentTurnResponse, AGENT_RUN_TURN_METHOD};
+use crate::channels::context::{ChannelRuntimeContext, CHANNEL_MESSAGE_TIMEOUT_SECS};
use crate::channels::Channel;
use crate::channels::ChannelSystemPrompt;
-use crate::channels::context::{CHANNEL_MESSAGE_TIMEOUT_SECS, ChannelRuntimeContext};
use crate::config::{MultimodalConfig, MultimodalFileConfig, ReliabilityConfig};
use crate::core::bus::BUS;
use crate::core::events::DomainEvent;
diff --git a/crates/openhuman-core/src/channels/tests/common.rs b/crates/openhuman-core/src/channels/tests/common.rs
index ebfd74d536..924c227b8b 100644
--- a/crates/openhuman-core/src/channels/tests/common.rs
+++ b/crates/openhuman-core/src/channels/tests/common.rs
@@ -140,7 +140,10 @@ impl Channel for TelegramRecordingChannel {
"telegram"
}
- #[allow(deprecated, reason = "Channel still requires its v21 adapter for one release")]
+ #[allow(
+ deprecated,
+ reason = "Channel still requires its v21 adapter for one release"
+ )]
async fn send(&self, message: &traits::SendMessage) -> anyhow::Result<()> {
self.sent_messages
.lock()
@@ -149,10 +152,7 @@ impl Channel for TelegramRecordingChannel {
Ok(())
}
- async fn send_typed(
- &self,
- message: &traits::ChannelOutboundMessage,
- ) -> anyhow::Result<()> {
+ async fn send_typed(&self, message: &traits::ChannelOutboundMessage) -> anyhow::Result<()> {
self.sent_messages.lock().await.push(format!(
"{}:{}",
message.conversation_id,
@@ -161,7 +161,10 @@ impl Channel for TelegramRecordingChannel {
Ok(())
}
- #[allow(deprecated, reason = "Channel still requires its v21 listener for one release")]
+ #[allow(
+ deprecated,
+ reason = "Channel still requires its v21 listener for one release"
+ )]
async fn listen(
&self,
_tx: tokio::sync::mpsc::Sender<traits::ChannelMessage>,
@@ -184,7 +187,10 @@ impl Channel for RecordingChannel {
"test-channel"
}
- #[allow(deprecated, reason = "Channel still requires its v21 adapter for one release")]
+ #[allow(
+ deprecated,
+ reason = "Channel still requires its v21 adapter for one release"
+ )]
async fn send(&self, message: &traits::SendMessage) -> anyhow::Result<()> {
self.sent_messages
.lock()
@@ -193,10 +199,7 @@ impl Channel for RecordingChannel {
Ok(())
}
- async fn send_typed(
- &self,
- message: &traits::ChannelOutboundMessage,
- ) -> anyhow::Result<()> {
+ async fn send_typed(&self, message: &traits::ChannelOutboundMessage) -> anyhow::Result<()> {
self.sent_messages.lock().await.push(format!(
"{}:{}",
message.conversation_id,
@@ -205,7 +208,10 @@ impl Channel for RecordingChannel {
Ok(())
}
- #[allow(deprecated, reason = "Channel still requires its v21 listener for one release")]
+ #[allow(
+ deprecated,
+ reason = "Channel still requires its v21 listener for one release"
+ )]
async fn listen(
&self,
_tx: tokio::sync::mpsc::Sender<traits::ChannelMessage>,
@@ -415,12 +421,18 @@ impl Channel for AlwaysFailChannel {
self.name
}
- #[allow(deprecated, reason = "Channel still requires its v21 adapter for one release")]
+ #[allow(
+ deprecated,
+ reason = "Channel still requires its v21 adapter for one release"
+ )]
async fn send(&self, _message: &traits::SendMessage) -> anyhow::Result<()> {
Ok(())
}
- #[allow(deprecated, reason = "Channel still requires its v21 listener for one release")]
+ #[allow(
+ deprecated,
+ reason = "Channel still requires its v21 listener for one release"
+ )]
async fn listen(
&self,
_tx: tokio::sync::mpsc::Sender<traits::ChannelMessage>,
diff --git a/crates/openhuman-core/src/channels/tests/discord_integration.rs b/crates/openhuman-core/src/channels/tests/discord_integration.rs
index fc78898053..2881c6173b 100644
--- a/crates/openhuman-core/src/channels/tests/discord_integration.rs
+++ b/crates/openhuman-core/src/channels/tests/discord_integration.rs
@@ -54,23 +54,27 @@ impl Channel for DiscordRecordingChannel {
"discord"
}
- #[allow(deprecated, reason = "Channel still requires its v21 adapter for one release")]
+ #[allow(
+ deprecated,
+ reason = "Channel still requires its v21 adapter for one release"
+ )]
async fn send(&self, message: &traits::SendMessage) -> anyhow::Result<()> {
self.send_typed(&traits::ChannelOutboundMessage::from_legacy_message(
- self.name(), message,
+ self.name(),
+ message,
))
.await
}
- async fn send_typed(
- &self,
- message: &traits::ChannelOutboundMessage,
- ) -> anyhow::Result<()> {
+ async fn send_typed(&self, message: &traits::ChannelOutboundMessage) -> anyhow::Result<()> {
self.sent.lock().await.push(message.clone());
Ok(())
}
- #[allow(deprecated, reason = "Channel still requires its v21 listener for one release")]
+ #[allow(
+ deprecated,
+ reason = "Channel still requires its v21 listener for one release"
+ )]
async fn listen(
&self,
_tx: tokio::sync::mpsc::Sender<traits::ChannelMessage>,
@@ -169,7 +173,7 @@ async fn discord_inbound_dispatches_through_full_pipeline() {
"discord_msg_1",
1,
None,
- None
+ None,
),
)
.await;
@@ -220,7 +224,7 @@ async fn discord_threaded_message_does_not_emit_reaction_ack() {
"discord_msg_2",
1,
Some("thread-42"),
- None
+ None,
),
)
.await;
@@ -233,10 +237,7 @@ async fn discord_threaded_message_does_not_emit_reaction_ack() {
"Discord must not receive an ack reaction alongside the reply"
);
assert!(
- !sent[0]
- .legacy_text()
- .unwrap()
- .starts_with("[REACTION:"),
+ !sent[0].legacy_text().unwrap().starts_with("[REACTION:"),
"discord send must not contain a reaction marker, got {:?}",
sent[0].legacy_text().unwrap()
);
@@ -265,15 +266,15 @@ async fn discord_thread_ts_splits_conversation_history_end_to_end() {
let ctx = make_discord_ctx(channel, provider);
let first = channel_envelope(
- "discord",
- "user-123",
- "channel-456",
- "first thread message",
- "discord_msg_a",
- 1,
- Some("thread-A"),
- None
- );
+ "discord",
+ "user-123",
+ "channel-456",
+ "first thread message",
+ "discord_msg_a",
+ 1,
+ Some("thread-A"),
+ None,
+ );
let mut second = first.clone();
second.message_id = "discord_msg_b".to_string();
diff --git a/crates/openhuman-core/src/channels/tests/health.rs b/crates/openhuman-core/src/channels/tests/health.rs
index 17e0230fe7..5596b27866 100644
--- a/crates/openhuman-core/src/channels/tests/health.rs
+++ b/crates/openhuman-core/src/channels/tests/health.rs
@@ -7,6 +7,10 @@ use std::time::Duration;
use tinychannels_bus as traits;
#[tokio::test]
+#[allow(
+ deprecated,
+ reason = "health test exercises the v21 listener compatibility seam"
+)]
async fn supervised_listener_marks_error_and_restarts_on_failures() {
let calls = Arc::new(AtomicUsize::new(0));
let name = Box::leak(format!("test-supervised-fail-{}", uuid::Uuid::new_v4()).into_boxed_str());
diff --git a/crates/openhuman-core/src/channels/tests/runtime_dispatch.rs b/crates/openhuman-core/src/channels/tests/runtime_dispatch.rs
index 8cc619d7c2..832842ebca 100644
--- a/crates/openhuman-core/src/channels/tests/runtime_dispatch.rs
+++ b/crates/openhuman-core/src/channels/tests/runtime_dispatch.rs
@@ -150,7 +150,8 @@ async fn message_dispatch_processes_messages_in_parallel() {
let (parallel_channel, parallel_ctx) = build_runtime();
let (tx, rx) = tokio::sync::mpsc::channel::<RuntimeChannelMessage>(4);
- tx.send(RuntimeChannelMessage::with_inbound_envelope(channel_envelope(
+ tx.send(RuntimeChannelMessage::with_inbound_envelope(
+ channel_envelope(
"test-channel",
"alice",
"alice",
@@ -158,20 +159,14 @@ async fn message_dispatch_processes_messages_in_parallel() {
"1",
1,
None,
- None
- )))
+ None,
+ ),
+ ))
.await
.unwrap();
- tx.send(RuntimeChannelMessage::with_inbound_envelope(channel_envelope(
- "test-channel",
- "bob",
- "bob",
- "world",
- "2",
- 2,
- None,
- None
- )))
+ tx.send(RuntimeChannelMessage::with_inbound_envelope(
+ channel_envelope("test-channel", "bob", "bob", "world", "2", 2, None, None),
+ ))
.await
.unwrap();
drop(tx);
@@ -237,7 +232,7 @@ async fn process_channel_message_cancels_scoped_typing_task() {
"typing-msg",
1,
None,
- None
+ None,
),
)
.await;
@@ -327,7 +322,7 @@ async fn dispatch_routes_through_agent_run_turn_bus_handler() {
"bus-stub-msg",
1,
None,
- None
+ None,
),
)
.await;
@@ -462,7 +457,7 @@ async fn run_resolved_route_message(message_id: &str, noise_after: usize) {
message_id.to_string(),
1,
None,
- None
+ None,
),
)
.await;
@@ -584,7 +579,7 @@ async fn process_channel_message_hardens_multimodal_files_against_smuggled_marke
"smuggle-attempt",
1,
None,
- None
+ None,
),
)
.await;
@@ -667,7 +662,7 @@ async fn process_channel_message_hardens_against_relative_path_markers() {
"smuggle-attempt-relative",
1,
None,
- None
+ None,
),
)
.await;
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 fc58048eae..5cf705c5cc 100644
--- a/crates/openhuman-core/src/channels/tests/runtime_tool_calls.rs
+++ b/crates/openhuman-core/src/channels/tests/runtime_tool_calls.rs
@@ -61,7 +61,7 @@ async fn process_channel_message_executes_native_tool_calls() {
"msg-2",
2,
None,
- None
+ None,
),
)
.await;
@@ -125,15 +125,15 @@ async fn process_channel_message_handles_models_command_without_llm_call() {
});
let cmd_msg = channel_envelope(
- "telegram",
- "alice",
- "chat-1",
- "/models openhuman",
- "msg-cmd-1",
- 1,
- None,
- None
- );
+ "telegram",
+ "alice",
+ "chat-1",
+ "/models openhuman",
+ "msg-cmd-1",
+ 1,
+ None,
+ None,
+ );
let route_key = conversation_history_key(&cmd_msg);
process_channel_message(runtime_ctx.clone(), cmd_msg).await;
@@ -180,15 +180,15 @@ async fn process_channel_message_uses_route_override_provider_and_model() {
);
let routed_msg = channel_envelope(
- "telegram",
- "alice",
- "chat-1",
- "hello routed provider",
- "msg-routed-1",
- 2,
- None,
- None
- );
+ "telegram",
+ "alice",
+ "chat-1",
+ "hello routed provider",
+ "msg-routed-1",
+ 2,
+ None,
+ None,
+ );
let route_key = conversation_history_key(&routed_msg);
let mut route_overrides = HashMap::new();
route_overrides.insert(
@@ -288,7 +288,7 @@ async fn process_channel_message_respects_configured_max_tool_iterations_above_d
"msg-iter-success",
1,
None,
- None
+ None,
),
)
.await;
@@ -348,7 +348,7 @@ async fn process_channel_message_reports_configured_max_tool_iterations_limit()
"msg-iter-fail",
2,
None,
- None
+ None,
),
)
.await;
diff --git a/crates/openhuman-core/src/channels/tests/telegram_integration.rs b/crates/openhuman-core/src/channels/tests/telegram_integration.rs
index df6d1f57e0..11e86730e1 100644
--- a/crates/openhuman-core/src/channels/tests/telegram_integration.rs
+++ b/crates/openhuman-core/src/channels/tests/telegram_integration.rs
@@ -34,23 +34,27 @@ impl Channel for FullRecordingChannel {
"test-channel"
}
- #[allow(deprecated, reason = "Channel still requires its v21 adapter for one release")]
+ #[allow(
+ deprecated,
+ reason = "Channel still requires its v21 adapter for one release"
+ )]
async fn send(&self, message: &traits::SendMessage) -> anyhow::Result<()> {
self.send_typed(&traits::ChannelOutboundMessage::from_legacy_message(
- self.name(), message,
+ self.name(),
+ message,
))
.await
}
- async fn send_typed(
- &self,
- message: &traits::ChannelOutboundMessage,
- ) -> anyhow::Result<()> {
+ async fn send_typed(&self, message: &traits::ChannelOutboundMessage) -> anyhow::Result<()> {
self.sent.lock().await.push(message.clone());
Ok(())
}
- #[allow(deprecated, reason = "Channel still requires its v21 listener for one release")]
+ #[allow(
+ deprecated,
+ reason = "Channel still requires its v21 listener for one release"
+ )]
async fn listen(
&self,
_tx: tokio::sync::mpsc::Sender<traits::ChannelMessage>,
@@ -140,7 +144,7 @@ async fn inbound_thread_ts_is_forwarded_to_channel_send() {
"tg_100_99",
1,
Some("99"),
- None
+ None,
),
)
.await;
@@ -178,7 +182,7 @@ async fn no_thread_ts_on_inbound_message_results_in_none_on_send() {
"tg_100_55",
1,
None,
- None
+ None,
),
)
.await;
@@ -216,7 +220,7 @@ async fn reaction_marker_in_llm_response_is_passed_to_channel_send() {
"tg_100_42",
1,
Some("42"),
- None
+ None,
),
)
.await;
@@ -228,7 +232,8 @@ async fn reaction_marker_in_llm_response_is_passed_to_channel_send() {
"expected exactly one send for a reaction marker"
);
assert_eq!(
- sent[0].legacy_text().unwrap(), "[REACTION:👍]",
+ sent[0].legacy_text().unwrap(),
+ "[REACTION:👍]",
"reaction marker must be delivered verbatim to channel.send"
);
assert_eq!(
@@ -268,7 +273,7 @@ async fn typing_indicator_starts_and_stops_once_per_message() {
"typing-test",
1,
None,
- None
+ None,
),
)
.await;
@@ -291,15 +296,8 @@ async fn typing_indicator_starts_and_stops_once_per_message() {
#[test]
fn telegram_channel_history_key_ignores_thread_ts() {
let base_msg = channel_envelope(
- "telegram",
- "alice",
- "100",
- "hello",
- "tg_100_1",
- 1,
- None,
- None
- );
+ "telegram", "alice", "100", "hello", "tg_100_1", 1, None, None,
+ );
let mut msg_with_thread = base_msg.clone();
msg_with_thread.message_id = "tg_100_2".to_string();
@@ -342,23 +340,27 @@ impl Channel for TelegramReactingChannel {
"telegram"
}
- #[allow(deprecated, reason = "Channel still requires its v21 adapter for one release")]
+ #[allow(
+ deprecated,
+ reason = "Channel still requires its v21 adapter for one release"
+ )]
async fn send(&self, message: &traits::SendMessage) -> anyhow::Result<()> {
self.send_typed(&traits::ChannelOutboundMessage::from_legacy_message(
- self.name(), message,
+ self.name(),
+ message,
))
.await
}
- async fn send_typed(
- &self,
- message: &traits::ChannelOutboundMessage,
- ) -> anyhow::Result<()> {
+ async fn send_typed(&self, message: &traits::ChannelOutboundMessage) -> anyhow::Result<()> {
self.sent.lock().await.push(message.clone());
Ok(())
}
- #[allow(deprecated, reason = "Channel still requires its v21 listener for one release")]
+ #[allow(
+ deprecated,
+ reason = "Channel still requires its v21 listener for one release"
+ )]
async fn listen(
&self,
_tx: tokio::sync::mpsc::Sender<traits::ChannelMessage>,
@@ -400,7 +402,7 @@ async fn telegram_threaded_inbound_emits_ack_reaction_then_reply() {
"tg_200_77",
1,
Some("77"),
- None
+ None,
),
)
.await;
@@ -417,7 +419,10 @@ async fn telegram_threaded_inbound_emits_ack_reaction_then_reply() {
// inbound message_id so Telegram attaches the reaction correctly.
let reaction_sends: Vec<_> = sent
.iter()
- .filter(|m| m.legacy_text().is_ok_and(|text| text.starts_with("[REACTION:")))
+ .filter(|m| {
+ m.legacy_text()
+ .is_ok_and(|text| text.starts_with("[REACTION:"))
+ })
.collect();
assert_eq!(
reaction_sends.len(),
@@ -437,7 +442,10 @@ async fn telegram_threaded_inbound_emits_ack_reaction_then_reply() {
// thread_ts so Telegram threads the reply to the original message.
let reply_sends: Vec<_> = sent
.iter()
- .filter(|m| !m.legacy_text().is_ok_and(|text| text.starts_with("[REACTION:")))
+ .filter(|m| {
+ !m.legacy_text()
+ .is_ok_and(|text| text.starts_with("[REACTION:"))
+ })
.collect();
assert_eq!(
reply_sends.len(),
@@ -461,15 +469,15 @@ async fn telegram_threaded_inbound_emits_ack_reaction_then_reply() {
#[test]
fn non_telegram_channel_history_key_includes_thread_ts() {
let base_msg = channel_envelope(
- "slack",
- "alice",
- "C01",
- "hello",
- "slack_C01_1",
- 1,
- None,
- None
- );
+ "slack",
+ "alice",
+ "C01",
+ "hello",
+ "slack_C01_1",
+ 1,
+ None,
+ None,
+ );
let mut msg_in_thread = base_msg.clone();
msg_in_thread.message_id = "slack_C01_2".to_string();