Skip to content

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

fix(examples): bound printer drain wait with a timeout

Steven Enamakelb01bda3ce2ec
diff --git a/examples/run_turn.rs b/examples/run_turn.rs
index 95825ff9e9..0878c83f7e 100644
--- a/examples/run_turn.rs
+++ b/examples/run_turn.rs
@@ -134,7 +134,10 @@ async fn run() -> anyhow::Result<()> {
});
let outcome = harness.turn(&prompt).on_progress(tx).send().await?;
- printer.await.ok();
+ // Wait for the printer to drain, but bound it. A detached async sub-agent
+ // (`spawn_async_subagent`) can carry a clone of the sender past `send()`
+ // returning, so waiting on sender-drop alone could hang indefinitely.
+ let _ = tokio::time::timeout(std::time::Duration::from_secs(30), printer).await;
println!("\nsession: {}", outcome.session_id);
println!("{}", outcome.reply);