Skip to content

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

feat(agent): emit progress events for skill runs and web chat

Steven Enamakel1125bcaeaa83
diff --git a/crates/openhuman-core/src/agent/progress_sink_tests.rs b/crates/openhuman-core/src/agent/progress_sink_tests.rs
index 72ef160c71..f0990cfbe5 100644
--- a/crates/openhuman-core/src/agent/progress_sink_tests.rs
+++ b/crates/openhuman-core/src/agent/progress_sink_tests.rs
@@ -37,12 +37,12 @@ async fn nested_scope_yields_the_inner_sink() {
.expect("a sink is visible inside the nested scope");
observed
- .send(AgentProgress::TurnCompleted { iterations: 1 })
+ .send(AgentProgress::TurnCompleted { iterations: 1, stop: None })
.await
.expect("send on the innermost sink");
assert!(matches!(
inner_rx.recv().await,
- Some(AgentProgress::TurnCompleted { iterations: 1 })
+ Some(AgentProgress::TurnCompleted { iterations: 1, stop: None })
));
// The outer sink saw nothing — the inner scope shadows it.
assert!(outer_rx.try_recv().is_err());
diff --git a/crates/openhuman-core/src/agent/progress_tracing/collector/events.rs b/crates/openhuman-core/src/agent/progress_tracing/collector/events.rs
index 1aa5f5ea63..ea5c0c1f51 100644
--- a/crates/openhuman-core/src/agent/progress_tracing/collector/events.rs
+++ b/crates/openhuman-core/src/agent/progress_tracing/collector/events.rs
@@ -468,7 +468,7 @@ impl SpanCollector {
}
}
- AgentProgress::TurnCompleted { iterations } => {
+ AgentProgress::TurnCompleted { iterations, .. } => {
self.close_current_iteration(now_unix_ms);
if let Some(index) = self.turn_span_index {
let mut extra = BTreeMap::new();
diff --git a/crates/openhuman-core/src/agent/progress_tracing/progress_tracing_accuracy_tests.rs b/crates/openhuman-core/src/agent/progress_tracing/progress_tracing_accuracy_tests.rs
index 40f25c6d75..195c6e4d32 100644
--- a/crates/openhuman-core/src/agent/progress_tracing/progress_tracing_accuracy_tests.rs
+++ b/crates/openhuman-core/src/agent/progress_tracing/progress_tracing_accuracy_tests.rs
@@ -223,7 +223,7 @@ fn late_child_tool_completion_after_subagent_completed_closes_the_span() {
child_tool_completed("t1", "c1", "get_node_kind_contract", 4),
2_050,
),
- (AgentProgress::TurnCompleted { iterations: 1 }, 400_000),
+ (AgentProgress::TurnCompleted { iterations: 1, stop: None }, 400_000),
]);
c.finish(400_000);
let tool = find(c.spans(), "tool.get_node_kind_contract");
@@ -261,7 +261,7 @@ fn tool_without_completion_is_force_closed_at_its_parent_end() {
(tool_started("c1", "composio_list_toolkits", 1), 1_500),
(iteration(2), 2_000),
(simple_call("chat-v1"), 3_000),
- (AgentProgress::TurnCompleted { iterations: 2 }, 440_000),
+ (AgentProgress::TurnCompleted { iterations: 2, stop: None }, 440_000),
]);
c.finish(440_000);
let tool = find(c.spans(), "tool.composio_list_toolkits");
@@ -345,7 +345,7 @@ fn cancelled_turn_is_a_warning_not_an_error() {
fn completed_turn_is_not_reclassified_by_finish() {
let mut c = collect(&[
(AgentProgress::TurnStarted, 1_000),
- (AgentProgress::TurnCompleted { iterations: 1 }, 2_000),
+ (AgentProgress::TurnCompleted { iterations: 1, stop: None }, 2_000),
]);
c.finish_with_outcome(
3_000,
diff --git a/crates/openhuman-core/src/agent/progress_tracing/progress_tracing_span_tree_tests.rs b/crates/openhuman-core/src/agent/progress_tracing/progress_tracing_span_tree_tests.rs
index afeff15409..bfffb38cc5 100644
--- a/crates/openhuman-core/src/agent/progress_tracing/progress_tracing_span_tree_tests.rs
+++ b/crates/openhuman-core/src/agent/progress_tracing/progress_tracing_span_tree_tests.rs
@@ -64,7 +64,7 @@ fn full_turn_builds_correlated_span_tree() {
},
1_030,
),
- (AgentProgress::TurnCompleted { iterations: 1 }, 1_040),
+ (AgentProgress::TurnCompleted { iterations: 1, stop: None }, 1_040),
]);
c.finish(2_000);
let spans = c.spans();
diff --git a/crates/openhuman-core/src/agent/progress_tracing/progress_tracing_tests.rs b/crates/openhuman-core/src/agent/progress_tracing/progress_tracing_tests.rs
index bb07d4cad3..088b5e4d76 100644
--- a/crates/openhuman-core/src/agent/progress_tracing/progress_tracing_tests.rs
+++ b/crates/openhuman-core/src/agent/progress_tracing/progress_tracing_tests.rs
@@ -84,7 +84,7 @@ fn spawn(task: &str, display: &str) -> AgentProgress {
fn one_turn_spans() -> Vec<TraceSpan> {
let mut c = collect(&[
(AgentProgress::TurnStarted, 0),
- (AgentProgress::TurnCompleted { iterations: 1 }, 10),
+ (AgentProgress::TurnCompleted { iterations: 1, stop: None }, 10),
]);
c.finish(10);
c.into_spans()
diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session/post_commit_tests.rs b/crates/openhuman-core/src/agent/session_host/runtime_session/post_commit_tests.rs
index 4721673d3c..af405a3ca9 100644
--- a/crates/openhuman-core/src/agent/session_host/runtime_session/post_commit_tests.rs
+++ b/crates/openhuman-core/src/agent/session_host/runtime_session/post_commit_tests.rs
@@ -52,7 +52,7 @@ async fn completion_is_published_before_slow_post_commit_work_finishes() {
};
let publish = async {
progress_tx
- .send(AgentProgress::TurnCompleted { iterations: 1 })
+ .send(AgentProgress::TurnCompleted { iterations: 1, stop: None })
.await
.is_ok()
};
@@ -67,7 +67,7 @@ async fn completion_is_published_before_slow_post_commit_work_finishes() {
assert!(delivered);
assert!(matches!(
progress_rx.try_recv(),
- Ok(AgentProgress::TurnCompleted { iterations: 1 })
+ Ok(AgentProgress::TurnCompleted { iterations: 1, stop: None })
));
assert!(
!tail_done.load(std::sync::atomic::Ordering::SeqCst),
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 f86384143a..e17a02cf15 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
@@ -43,7 +43,7 @@ async fn committed_progress_uses_each_turns_receipt_sender() {
));
assert!(matches!(
second_rx.recv().await,
- Some(AgentProgress::TurnCompleted { iterations: 2 })
+ Some(AgentProgress::TurnCompleted { iterations: 2, stop: None })
));
assert!(matches!(
first_rx.try_recv(),
@@ -97,7 +97,7 @@ async fn committed_turn_completion_waits_for_a_full_progress_channel() {
tokio::time::timeout(std::time::Duration::from_secs(1), rx.recv())
.await
.expect("terminal progress event"),
- Some(AgentProgress::TurnCompleted { iterations: 2 })
+ Some(AgentProgress::TurnCompleted { iterations: 2, stop: None })
));
assert!(matches!(
tokio::time::timeout(std::time::Duration::from_secs(1), rx.recv())
diff --git a/crates/openhuman-core/src/agent/tinyagents/host/progress_sink.rs b/crates/openhuman-core/src/agent/tinyagents/host/progress_sink.rs
index 0593c45673..e273f81526 100644
--- a/crates/openhuman-core/src/agent/tinyagents/host/progress_sink.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/host/progress_sink.rs
@@ -565,7 +565,10 @@ impl ProgressSink for OpenHumanProgressSink {
);
return;
}
- self.forward_lifecycle(AgentProgress::TurnCompleted { iterations })
+ self.forward_lifecycle(AgentProgress::TurnCompleted {
+ iterations,
+ stop: None,
+ })
.await;
}
diff --git a/crates/openhuman-core/src/agent/tinyagents/host/progress_sink_tests.rs b/crates/openhuman-core/src/agent/tinyagents/host/progress_sink_tests.rs
index 9a8019006f..0a8f7dac9e 100644
--- a/crates/openhuman-core/src/agent/tinyagents/host/progress_sink_tests.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/host/progress_sink_tests.rs
@@ -388,7 +388,7 @@ async fn finished_maps_to_turn_completed_carrying_the_round_count() {
.await;
match rx.try_recv().expect("event forwarded") {
- AgentProgress::TurnCompleted { iterations } => assert_eq!(iterations, 2),
+ AgentProgress::TurnCompleted { iterations, .. } => assert_eq!(iterations, 2),
other => panic!("unexpected event: {other:?}"),
}
// Usage is deliberately NOT projected onto TurnCostUpdated — see the
@@ -406,7 +406,7 @@ async fn finished_without_usage_still_completes_the_turn() {
.await;
assert!(matches!(
rx.try_recv().expect("event forwarded"),
- AgentProgress::TurnCompleted { iterations: 1 }
+ AgentProgress::TurnCompleted { iterations: 1, stop: None }
));
}
diff --git a/crates/openhuman-core/src/skills/run_log.rs b/crates/openhuman-core/src/skills/run_log.rs
index 3c18c1691e..8d7e10e6c9 100644
--- a/crates/openhuman-core/src/skills/run_log.rs
+++ b/crates/openhuman-core/src/skills/run_log.rs
@@ -221,7 +221,7 @@ pub fn format_event(ev: &AgentProgress) -> Option<String> {
" ⮑ subagent {agent_id} awaiting user: {}",
truncate(question, 200)
),
- AgentProgress::TurnCompleted { iterations } => {
+ AgentProgress::TurnCompleted { iterations, .. } => {
format!("turn completed ({iterations} iterations)")
}
// Noisy / non-step events — skipped (the final text is in the footer).
diff --git a/crates/openhuman-core/src/threads/turn_state/mirror_observe_tests.rs b/crates/openhuman-core/src/threads/turn_state/mirror_observe_tests.rs
index 9f50a3ff41..c07b545724 100644
--- a/crates/openhuman-core/src/threads/turn_state/mirror_observe_tests.rs
+++ b/crates/openhuman-core/src/threads/turn_state/mirror_observe_tests.rs
@@ -447,7 +447,7 @@ fn turn_completed_keeps_snapshot_as_completed_and_finish_is_noop() {
let dir = tempdir().expect("tempdir");
let store = TurnStateStore::new(dir.path().to_path_buf());
let mut mirror = TurnStateMirror::new(store.clone(), "t", "req-1");
- mirror.observe(&AgentProgress::TurnCompleted { iterations: 3 });
+ mirror.observe(&AgentProgress::TurnCompleted { iterations: 3, stop: None });
// The snapshot is kept (not deleted) so a reloaded client can replay the
// finished turn's processing transcript, marked terminal `Completed` with
// the live fields quiesced.
diff --git a/crates/openhuman-core/src/voice/realtime_harness_tests.rs b/crates/openhuman-core/src/voice/realtime_harness_tests.rs
index cd3acdb395..179ad526cb 100644
--- a/crates/openhuman-core/src/voice/realtime_harness_tests.rs
+++ b/crates/openhuman-core/src/voice/realtime_harness_tests.rs
@@ -102,7 +102,7 @@ fn spoken_delta_suppresses_internal_events() {
);
// Lifecycle events carry no spoken text.
assert_eq!(
- spoken_delta(&AgentProgress::TurnCompleted { iterations: 1 }),
+ spoken_delta(&AgentProgress::TurnCompleted { iterations: 1, stop: None }),
None
);
}
diff --git a/crates/openhuman-core/src/web_chat/progress_bridge.rs b/crates/openhuman-core/src/web_chat/progress_bridge.rs
index 896b1345bd..5fb675c1d9 100644
--- a/crates/openhuman-core/src/web_chat/progress_bridge.rs
+++ b/crates/openhuman-core/src/web_chat/progress_bridge.rs
@@ -1084,7 +1084,7 @@ pub(crate) fn spawn_progress_bridge(
},
);
}
- AgentProgress::TurnCompleted { iterations } => {
+ AgentProgress::TurnCompleted { iterations, .. } => {
parent_completed = true;
timing.done(iterations, MIN_INTERIM_NARRATION_CHARS, &request_id);
if let Ok(mut guard) = timing_snapshot_for_task.lock() {
diff --git a/crates/openhuman-core/src/web_chat/progress_bridge_tests.rs b/crates/openhuman-core/src/web_chat/progress_bridge_tests.rs
index ee96209a4a..09c084124d 100644
--- a/crates/openhuman-core/src/web_chat/progress_bridge_tests.rs
+++ b/crates/openhuman-core/src/web_chat/progress_bridge_tests.rs
@@ -275,7 +275,7 @@ async fn stops_heartbeat_after_turn_completed() {
}
// Complete the turn, then drop the sender so the bridge loop breaks.
- tx.send(AgentProgress::TurnCompleted { iterations: 1 })
+ tx.send(AgentProgress::TurnCompleted { iterations: 1, stop: None })
.await
.unwrap();
drop(tx);
@@ -439,7 +439,7 @@ async fn wait_drained_returns_after_queued_events_are_forwarded() {
})
.await
.unwrap();
- tx.send(AgentProgress::TurnCompleted { iterations: 1 })
+ tx.send(AgentProgress::TurnCompleted { iterations: 1, stop: None })
.await
.unwrap();