Skip to content

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

feat(channels): add test-only dispatch helper for processor fixtures

Steven Enamakelfcbf106ab858
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 dbf254e092..1c841b181b 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
@@ -18,6 +18,7 @@ pub(super) async fn dispatch_bus_turn(
ctx: &ChannelRuntimeContext,
msg: &traits::ChannelMessage,
route: &ChannelRouteSelection,
+ message: &str,
history: Vec<TranscriptMessage>,
active_turn_model_source: Option<crate::agent::tinyagents::TurnModelSource>,
progress_tx: Option<tokio::sync::mpsc::Sender<AgentProgress>>,
@@ -124,3 +125,32 @@ pub(super) async fn dispatch_bus_turn(
other => anyhow::anyhow!("[agent.run_turn dispatch] {other}"),
})
}
+
+/// Keep the injected orchestrator graph available to processor unit fixtures
+/// without leaving a second production execution path behind.
+#[cfg(test)]
+pub(super) async fn dispatch_test_turn(
+ ctx: &ChannelRuntimeContext,
+ msg: &traits::ChannelMessage,
+ route: &ChannelRouteSelection,
+ active_turn_model_source: Option<crate::agent::tinyagents::TurnModelSource>,
+ progress_tx: Option<tokio::sync::mpsc::Sender<AgentProgress>>,
+ turn_origin: AgentTurnOrigin,
+ approval: crate::security::approval::ApprovalTurnContext,
+) -> anyhow::Result<AgentTurnResponse> {
+ let history = vec![
+ TranscriptMessage::system(ctx.system_prompt.current().as_str()),
+ TranscriptMessage::user(message),
+ ];
+ dispatch_bus_turn(
+ ctx,
+ msg,
+ route,
+ history,
+ active_turn_model_source,
+ progress_tx,
+ turn_origin,
+ approval,
+ )
+ .await
+}
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 2fb8d02130..8f7d3b8067 100644
--- a/crates/openhuman-core/src/channels/runtime/dispatch/processor/turn.rs
+++ b/crates/openhuman-core/src/channels/runtime/dispatch/processor/turn.rs
@@ -23,8 +23,6 @@ use super::super::helpers::{
};
use super::super::host_agent::{self, HostRoute};
use super::approval::{channel_has_approval_surface, try_route_approval_reply};
-#[cfg(test)]
-use super::bus_turn::dispatch_bus_turn;
use super::reset_durable_channel_session;
use super::RuntimeChannelMessage;
@@ -504,16 +502,11 @@ pub(crate) async fn process_channel_runtime_message(
}
#[cfg(test)]
None => {
- let system_prompt = ctx.system_prompt.current();
- let history = vec![
- tinyagents_session::transcript::TranscriptMessage::system(system_prompt.as_str()),
- tinyagents_session::transcript::TranscriptMessage::user(&enriched_message),
- ];
- let result = dispatch_bus_turn(
+ let result = super::bus_turn::dispatch_test_turn(
ctx.as_ref(),
&msg,
&route,
- history,
+ &enriched_message,
active_turn_model_source,
progress_tx,
turn_origin,