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
fix: preserve committed turn completion under progress backpressure
Steven Enamakeld9ca0e36d063
diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session.rs b/crates/openhuman-core/src/agent/session_host/runtime_session.rsindex f501f87542..0f1265d288 100644--- a/crates/openhuman-core/src/agent/session_host/runtime_session.rs+++ b/crates/openhuman-core/src/agent/session_host/runtime_session.rs@@ -28,6 +28,32 @@ use super::announcement_notes::{};use super::types::OpenHumanSessionHost;+/// The terminal event is the progress bridge's drain fence. Unlike content+/// capture, it must wait for space in a busy channel so the response cannot+/// overtake queued tool events on the web socket.+async fn send_committed_turn_progress(+ progress: &tokio::sync::mpsc::Sender<crate::agent::progress::AgentProgress>,+ input: &str,+ output: &str,+ iterations: u32,+) {+ use crate::agent::progress::AgentProgress;++ let _ = progress.try_send(AgentProgress::TurnContent {+ input: Some(input.to_string()),+ output: Some(output.to_string()),+ });+ if progress+ .send(AgentProgress::TurnCompleted { iterations })+ .await+ .is_err()+ {+ log::warn!(+ "[agent_session] committed turn completion not delivered: progress receiver closed"+ );+ }+}+/// Mutable product state observed by the runtime hooks.////// This type has no message accumulator, raw transcript rows, prefix matching,@@ -1776,22 +1802,17 @@ impl OpenHumanSessionHost {.lock().unwrap_or_else(|poisoned| poisoned.into_inner()).last_commit = Some(receipt);- let mut state = state- .lock()- .unwrap_or_else(|poisoned| poisoned.into_inner());- state.last_turn_hit_cap = interrupted;- state.last_turn_usage = Some(usage);- state.last_turn_citations = citations;+ {+ let mut state = state+ .lock()+ .unwrap_or_else(|poisoned| poisoned.into_inner());+ state.last_turn_hit_cap = interrupted;+ state.last_turn_usage = Some(usage);+ state.last_turn_citations = citations;+ }if let Some(progress) = &progress {- let _ = progress.try_send(- crate::agent::progress::AgentProgress::TurnContent {- input: Some(input.clone()),- output: Some(output.clone()),- },- );- let _ = progress.try_send(- crate::agent::progress::AgentProgress::TurnCompleted { iterations },- );+ send_committed_turn_progress(progress, &input, &output, iterations)+ .await;}crate::agent::hooks::fire_hooks(&post_turn_hooks,diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session_tests.rs b/crates/openhuman-core/src/agent/session_host/runtime_session_tests.rsindex 71577ade52..f208d075ad 100644--- a/crates/openhuman-core/src/agent/session_host/runtime_session_tests.rs+++ b/crates/openhuman-core/src/agent/session_host/runtime_session_tests.rs@@ -5,6 +5,32 @@ use std::sync::Arc;use tinyagents_runtime::ToolSnapshot;use tinytools::ToolSpec;+/// A full progress channel must not discard the only terminal signal. A busy+/// bridge can catch up after the turn commits; it cannot infer completion from+/// an event that was dropped.+#[tokio::test]+async fn committed_turn_completion_waits_for_a_full_progress_channel() {+ use crate::agent::progress::AgentProgress;++ let (tx, mut rx) = tokio::sync::mpsc::channel(1);+ tx.send(AgentProgress::TurnStarted).await.unwrap();+ let send = super::send_committed_turn_progress(&tx, "question", "answer", 2);+ tokio::pin!(send);+ assert!(matches!(+ futures::poll!(send.as_mut()),+ std::task::Poll::Pending+ ));++ assert!(matches!(rx.recv().await, Some(AgentProgress::TurnStarted)));+ send.await;+ assert!(matches!(+ tokio::time::timeout(std::time::Duration::from_secs(1), rx.recv())+ .await+ .expect("terminal progress event"),+ Some(AgentProgress::TurnCompleted { iterations: 2 })+ ));+}+fn spec(name: &str) -> ToolSpec {ToolSpec {name: name.into(),