Skip to content

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

fix(channels): abort progress forwarder when turn ends

Steven Enamakel5db091f8bab4
diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/native_runner.rs b/crates/openhuman-core/src/channels/runtime/dispatch/native_runner.rs
index 69fe91328a..6dc8ab0adc 100644
--- a/crates/openhuman-core/src/channels/runtime/dispatch/native_runner.rs
+++ b/crates/openhuman-core/src/channels/runtime/dispatch/native_runner.rs
@@ -142,7 +142,7 @@ impl TurnHost<QueuedPayload> for NativeHost {
.ok_or_else(|| "channel turn has no trusted host context".to_owned())?;
let (agent_progress, mut progress_rx) = mpsc::channel(64);
let progress_forwarder = request.payload.ctx.as_ref().map(|dispatch| {
- dispatch.clone().spawn(async move {
+ tokio_util::task::AbortOnDropHandle::new(dispatch.clone().spawn(async move {
while let Some(event) = progress_rx.recv().await {
if progress
.send(TurnSignal::Progress(Box::new(event)))
@@ -152,7 +152,7 @@ impl TurnHost<QueuedPayload> for NativeHost {
break;
}
}
- })
+ }))
});
let response = crate::channels::runtime::dispatch::host_agent::run_host_agent_turn(
trusted.host_agent.clone(),