The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
refactor(web_chat): extract followup dispatch into its own module
Steven Enamakel12af14c86f86
diff --git a/crates/openhuman-core/src/web_chat/ops.rs b/crates/openhuman-core/src/web_chat/ops.rsindex ba2f0e50ec..0ef8f58026 100644--- a/crates/openhuman-core/src/web_chat/ops.rs+++ b/crates/openhuman-core/src/web_chat/ops.rs@@ -5,6 +5,7 @@mod budget_correlation;mod channel_ops;+mod followups;mod parallel_turn;mod start_chat;mod state;diff --git a/crates/openhuman-core/src/web_chat/ops/followups.rs b/crates/openhuman-core/src/web_chat/ops/followups.rsnew file mode 100644index 0000000000..9edc44086f--- /dev/null+++ b/crates/openhuman-core/src/web_chat/ops/followups.rs@@ -0,0 +1,37 @@+//! Queued follow-up turns: once a turn finishes, the items its run queue+//! drained are started as fresh turns under the context the finished turn ran in.++use crate::web_chat::ops::start_chat;+use crate::web_chat::ChatRequestMetadata;++pub(super) fn dispatch_followups(+ ctx: &crate::core::runtime::DispatchCtx,+ followups: Vec<crate::agent::queued_turn::QueuedTurn>,+) {+ for fup in followups {+ let ctx = ctx.clone();+ tokio::spawn(crate::core::runtime::context::CoreContext::propagate(+ async move {+ if let Err(err) = start_chat(+ &ctx,+ &fup.client_id,+ &fup.thread_id,+ &fup.text,+ fup.model_override,+ fup.temperature,+ fup.locale,+ Some("followup".to_string()),+ ChatRequestMetadata::default(),+ )+ .await+ {+ log::warn!(+ "[web-channel] failed to dispatch followup thread_id={} err={}",+ fup.thread_id,+ err+ );+ }+ },+ ));+ }+}diff --git a/crates/openhuman-core/src/web_chat/ops/start_chat.rs b/crates/openhuman-core/src/web_chat/ops/start_chat.rsindex 18ad6ee658..be94a586db 100644--- a/crates/openhuman-core/src/web_chat/ops/start_chat.rs+++ b/crates/openhuman-core/src/web_chat/ops/start_chat.rs@@ -19,6 +19,7 @@ use super::super::event_bus::publish_web_channel_event;use super::super::run_task::run_chat_task;use super::super::types::{ChatRequestMetadata, InFlightEntry, QueueMode};use super::super::web_errors::classify_inference_error;+use super::followups::dispatch_followups;use super::parallel_turn::spawn_parallel_turn;use super::state::{cancel_in_flight_gracefully, in_flight, key_for};use super::turn_guards::{@@ -725,38 +726,6 @@ async fn start_chat_inner(Ok(request_id)}-fn dispatch_followups(- ctx: &crate::core::runtime::DispatchCtx,- followups: Vec<crate::agent::queued_turn::QueuedTurn>,-) {- for fup in followups {- let ctx = ctx.clone();- tokio::spawn(crate::core::runtime::context::CoreContext::propagate(- async move {- if let Err(err) = start_chat(- &ctx,- &fup.client_id,- &fup.thread_id,- &fup.text,- fup.model_override,- fup.temperature,- fup.locale,- Some("followup".to_string()),- ChatRequestMetadata::default(),- )- .await- {- log::warn!(- "[web-channel] failed to dispatch followup thread_id={} err={}",- fup.thread_id,- err- );- }- },- ));- }-}-#[cfg(test)]#[path = "start_chat_tests.rs"]mod tests;