Skip to content

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

fix(tinyagents): skip turn-stopped event when terminal is deferred

Steven Enamakeldf23f00344c3
diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_run_finalize.rs b/crates/openhuman-core/src/agent/tinyagents/turn_run_finalize.rs
index 6eb149ecc8..8dc0c6bd6d 100644
--- a/crates/openhuman-core/src/agent/tinyagents/turn_run_finalize.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/turn_run_finalize.rs
@@ -165,7 +165,7 @@ pub(super) async fn finalize_turn_outcome(
false,
hit_cap,
);
- if let Some(stop_fact) = stop.clone() {
+ if !defer_terminal_to_caller && let Some(stop_fact) = stop.clone() {
event_sink.emit(tinyagents_harness::events::AgentEvent::TurnStopped {
// The event uses a 1-based attempt ordinal, even when the run
// stopped before the first model request.