Skip to content

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

feat(channels): finalize native replies through progressive path

Steven Enamakel3585bf04a633
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 7e2e075448..6a1930fd85 100644
--- a/crates/openhuman-core/src/channels/runtime/dispatch/processor/turn.rs
+++ b/crates/openhuman-core/src/channels/runtime/dispatch/processor/turn.rs
@@ -542,6 +542,7 @@ pub(crate) async fn process_channel_runtime_message(
started_at.elapsed().as_millis(),
truncate_with_ellipsis(&response_text, REPLY_LOG_TRUNCATE_CHARS)
);
+ if !super::progressive::finish_native_reply(&native_reply, &response_text).await {
if let Some(channel) = target_channel.as_ref() {
if let Some(ref draft_id) = draft_message_id {
if let Err(e) = channel
@@ -571,6 +572,7 @@ pub(crate) async fn process_channel_runtime_message(
eprintln!(" ❌ Failed to reply on {}: {e}", channel.name());
}
}
+ }
(true, response_text, resolved_provider, resolved_model)
}
Ok(Err(e)) => {
@@ -583,6 +585,7 @@ pub(crate) async fn process_channel_runtime_message(
" ⚠️ Context window exceeded after {}ms",
started_at.elapsed().as_millis()
);
+ if !super::progressive::finish_native_reply(&native_reply, error_text).await {
if let Some(channel) = target_channel.as_ref() {
if let Some(ref draft_id) = draft_message_id {
let _ = channel
@@ -602,6 +605,7 @@ pub(crate) async fn process_channel_runtime_message(
.await;
}
}
+ }
BUS.publish(DomainEvent::ChannelMessageProcessed {
channel: msg.channel.clone(),
@@ -672,6 +676,7 @@ pub(crate) async fn process_channel_runtime_message(
],
);
}
+ if !super::progressive::finish_native_reply(&native_reply, &error_response).await {
if let Some(channel) = target_channel.as_ref() {
if let Some(ref draft_id) = draft_message_id {
let _ = channel
@@ -691,6 +696,7 @@ pub(crate) async fn process_channel_runtime_message(
.await;
}
}
+ }
(
false,
error_response,
@@ -716,6 +722,7 @@ pub(crate) async fn process_channel_runtime_message(
);
let error_text =
"⚠️ Request timed out while waiting for the model. Please try again.".to_string();
+ if !super::progressive::finish_native_reply(&native_reply, &error_text).await {
if let Some(channel) = target_channel.as_ref() {
if let Some(ref draft_id) = draft_message_id {
let _ = channel
@@ -735,6 +742,7 @@ pub(crate) async fn process_channel_runtime_message(
.await;
}
}
+ }
(
false,
error_text,