Skip to content

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

refactor(tinyagents): pass dispatch context into turn finalization

Steven Enamakeld11705644552
diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_exec.rs b/crates/openhuman-core/src/agent/tinyagents/turn_exec.rs
index e73d220fc9..890ebd6a43 100644
--- a/crates/openhuman-core/src/agent/tinyagents/turn_exec.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/turn_exec.rs
@@ -670,6 +670,7 @@ async fn drive_turn(
&tool_outcome_sink,
resolved_route,
request_base_len,
+ &run_context.dispatch_ctx(),
)
.await)
}
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 7ec4f3a3f4..4e51a406be 100644
--- a/crates/openhuman-core/src/agent/tinyagents/turn_run_finalize.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/turn_run_finalize.rs
@@ -46,6 +46,7 @@ pub(super) async fn finalize_turn_outcome(
tool_outcome_sink: &ToolOutcomeSink,
resolved_route: Option<tinyinference_llm::model::ResolvedModelRoute>,
request_base_len: usize,
+ dispatch: &crate::core::runtime::DispatchCtx,
) -> TinyagentsTurnOutcome {
// Durable journal: the harness returned a transcript, so stamp the terminal
// completed status (best-effort, non-fatal). The event stream carries no
@@ -117,7 +118,7 @@ pub(super) async fn finalize_turn_outcome(
.with_cached_input_tokens(cached),
);
crate::agent::tinyagents::turn_outcome::record_unobserved_turn_usage(
- &run_context.dispatch_ctx(),
+ dispatch,
model, input, output, cached, estimate,
);
let mut cost = tinyagents_harness::cost::CostTally::default();
diff --git a/crates/openhuman-core/src/security/approval/gate_state.rs b/crates/openhuman-core/src/security/approval/gate_state.rs
index 726229ba90..d45fdb0dc1 100644
--- a/crates/openhuman-core/src/security/approval/gate_state.rs
+++ b/crates/openhuman-core/src/security/approval/gate_state.rs
@@ -1,3 +1,5 @@
+use crate::core::runtime::DispatchCtx;
+
impl ApprovalGate {
/// Write the *terminal* status of a tool call onto its approval
/// audit row — see [`store::record_execution`] for semantics.