Skip to content

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

docs(tinyagents): add abort guard module and update module documentation

Steven Enamakel1d157502d34a
diff --git a/crates/openhuman-core/src/agent/tinyagents/README.md b/crates/openhuman-core/src/agent/tinyagents/README.md
index d145e3bb3f..3625280ca0 100644
--- a/crates/openhuman-core/src/agent/tinyagents/README.md
+++ b/crates/openhuman-core/src/agent/tinyagents/README.md
@@ -43,7 +43,6 @@ The adapter seam between OpenHuman and the vendored [`tinyagents`](../../../../.
| `host/delegation.rs` | Explicit tracing-bound execution helpers over `tinyagents_graph::delegation`'s plan, execute, review, finalize graph. |
| `payload_summarizer.rs` | `PayloadSummarizer` trait, `SummarizeOutcome`/`UnavailableReason`, and the default `SubagentPayloadSummarizer` that compresses oversized tool results through the `summarizer` sub-agent instead of hard-truncating them. |
| `policy_denial.rs` | `maybe_enrich_policy_block`: rewrites `[policy-blocked]` tool results into structured what/why/workaround messages that tell the model to relay the denial rather than fabricate output. Called from `ToolOutcomeCaptureMiddleware`. |
-| `abort_guard.rs` | `AbortOnDrop`: ties a detached streaming-producer task's lifetime to its consumer stream so a dropped turn aborts the in-flight provider call (issue #4460). |
| `host/run_context.rs` + typed tool dispatch | `OpenHumanRunContext` owns one root `CancellationToken`; child contexts share it and recursive tools receive it from their typed parent `RunContext`. |
| `steering_forwarder.rs` | `SteeringForwarderGuard`: forwards `RunQueue` steer/collect messages into the harness `SteeringHandle`; abort-on-drop so drop-based cancellation always deregisters it (issue #4456). |
| `stop_hooks.rs` | `StopHookMiddleware`: evaluates OpenHuman `StopHook`s after each model call and pauses the run via steering on the first `Stop` decision. |
diff --git a/crates/openhuman-core/src/agent/tinyagents/abort_guard.rs b/crates/openhuman-core/src/agent/tinyagents/abort_guard.rs
deleted file mode 100644
index 578fe573ea..0000000000
--- a/crates/openhuman-core/src/agent/tinyagents/abort_guard.rs
+++ /dev/null
@@ -1,41 +0,0 @@
-//! RAII guard that aborts a spawned task when it is dropped (issue #4460).
-//!
-//! `native model streaming` runs the provider call in a detached `tokio::spawn`
-//! producer. Without a lifetime tie, a hard turn cancellation (`AbortHandle`)
-//! drops the consumer stream but leaves the producer running to completion — the
-//! provider call still finishes and is still billed. Holding the producer's
-//! [`JoinHandle`] inside this guard, and moving the guard into the consumer
-//! stream's state, ties the two lifetimes: dropping the stream (turn future
-//! aborted/dropped) drops the guard, which aborts the in-flight provider call.
-
-use tokio::task::JoinHandle;
-
-/// Aborts the wrapped task on drop unless it has already finished.
-pub(crate) struct AbortOnDrop {
- handle: JoinHandle<()>,
- /// Grep-friendly label for the abort debug log (e.g. the model name).
- label: String,
-}
-
-impl AbortOnDrop {
- pub(crate) fn new(handle: JoinHandle<()>, label: impl Into<String>) -> Self {
- Self {
- handle,
- label: label.into(),
- }
- }
-}
-
-impl Drop for AbortOnDrop {
- fn drop(&mut self) {
- if self.handle.is_finished() {
- // Producer already emitted its terminal item — nothing to abort.
- return;
- }
- tracing::debug!(
- label = %self.label,
- "[tinyagents] aborting in-flight provider stream producer on drop (turn cancelled) — #4460"
- );
- self.handle.abort();
- }
-}
diff --git a/crates/openhuman-core/src/agent/tinyagents/mod.rs b/crates/openhuman-core/src/agent/tinyagents/mod.rs
index 3fc49eb77f..53b79b137b 100644
--- a/crates/openhuman-core/src/agent/tinyagents/mod.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/mod.rs
@@ -19,7 +19,6 @@
//! `ask_user_clarification` early-exit pause are all re-wired onto the
//! tinyagents harness.
-pub(crate) mod abort_guard;
pub mod config;
pub mod discovery;
mod embeddings;