Skip to content

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

feat(session-host): track runtime session progress

Steven Enamakelc9583e162ef1
diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session_progress.rs b/crates/openhuman-core/src/agent/session_host/runtime_session_progress.rs
index 5f45881edd..14b1f5edbe 100644
--- a/crates/openhuman-core/src/agent/session_host/runtime_session_progress.rs
+++ b/crates/openhuman-core/src/agent/session_host/runtime_session_progress.rs
@@ -2,6 +2,7 @@
use crate::agent::progress::AgentProgress;
use crate::agent::tinyagents::host::OpenHumanRunContext;
+use crate::agent::turn_stop::TurnStop;
use tinyagents_runtime::CommitReceipt;
/// Preserve the response path if a progress receiver stays open but stops
@@ -18,7 +19,9 @@ pub(super) async fn send_receipt_progress(
iterations: u32,
) -> bool {
match receipt.options.context.progress.as_ref() {
- Some(progress) => send_committed_turn_progress(progress, input, output, iterations).await,
+ Some(progress) => {
+ send_committed_turn_progress(progress, input, output, iterations, None).await
+ }
None => false,
}
}
@@ -31,6 +34,7 @@ pub(super) async fn send_committed_turn_progress(
input: &str,
output: &str,
iterations: u32,
+ stop: Option<TurnStop>,
) -> bool {
let content = AgentProgress::TurnContent {
input: Some(input.to_string()),
@@ -47,7 +51,7 @@ pub(super) async fn send_committed_turn_progress(
};
let completed = match tokio::time::timeout(
COMMITTED_TURN_PROGRESS_TIMEOUT,
- progress.send(AgentProgress::TurnCompleted { iterations }),
+ progress.send(AgentProgress::TurnCompleted { iterations, stop }),
)
.await
{
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.rs
index e17a02cf15..bdff79b51f 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
@@ -84,7 +84,7 @@ async fn committed_turn_completion_waits_for_a_full_progress_channel() {
let (tx, mut rx) = tokio::sync::mpsc::channel(1);
tx.send(AgentProgress::TurnStarted).await.unwrap();
- let send = super::progress::send_committed_turn_progress(&tx, "question", "answer", 2);
+ let send = super::progress::send_committed_turn_progress(&tx, "question", "answer", 2, None);
tokio::pin!(send);
assert!(matches!(
futures::poll!(send.as_mut()),
@@ -119,7 +119,7 @@ async fn committed_turn_completion_is_bounded_when_progress_stalls() {
let (tx, mut rx) = tokio::sync::mpsc::channel(1);
tx.send(AgentProgress::TurnStarted).await.unwrap();
- assert!(!super::progress::send_committed_turn_progress(&tx, "question", "answer", 2).await);
+ assert!(!super::progress::send_committed_turn_progress(&tx, "question", "answer", 2, None).await);
assert!(matches!(rx.recv().await, Some(AgentProgress::TurnStarted)));
assert!(rx.try_recv().is_err(), "timed-out send must be cancelled");
}