The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
fix(tinyagents): replace raw AtomicBool with FinalCallWrapUpMiddleware for wrap-up detection
Steven Enamakel530c85eecf3e
diff --git a/crates/openhuman-core/src/agent/tinyagents/harness_assembly.rs b/crates/openhuman-core/src/agent/tinyagents/harness_assembly.rsindex 0d1a9d5e89..73a6054607 100644--- a/crates/openhuman-core/src/agent/tinyagents/harness_assembly.rs+++ b/crates/openhuman-core/src/agent/tinyagents/harness_assembly.rs@@ -78,7 +78,7 @@ pub(super) struct AssembledTurnHarness {/// A flag rather than an inference off the run, because this turn now ends/// the way a finished one does — the model returns text and requests no/// tools — so `final_response.is_none()` no longer tells the two apart.- pub(super) wrap_up_fired: Option<Arc<std::sync::atomic::AtomicBool>>,+ pub(super) wrap_up_fired: Option<Arc<FinalCallWrapUpMiddleware>>,/// Number of callable tools registered.pub(super) tool_count: usize,/// TinyAgents named-capability projection for this turn. The live run stilldiff --git a/crates/openhuman-core/src/agent/tinyagents/harness_context_ladder.rs b/crates/openhuman-core/src/agent/tinyagents/harness_context_ladder.rsindex a07fc7de98..aa14a3682d 100644--- a/crates/openhuman-core/src/agent/tinyagents/harness_context_ladder.rs+++ b/crates/openhuman-core/src/agent/tinyagents/harness_context_ladder.rs@@ -58,7 +58,7 @@ pub(super) fn install_context_ladder(tool_outcome_sink: &ToolOutcomeSink,) -> (Option<Arc<ContextCompressionMiddleware>>,- Option<Arc<std::sync::atomic::AtomicBool>>,+ Option<Arc<FinalCallWrapUpMiddleware>>,) {// Autocompaction parity: when the provider's context window is known, install// the two-stage context-management step (issue #4249).diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_run_finalize.rs b/crates/openhuman-core/src/agent/tinyagents/turn_run_finalize.rsindex 7b5c8de994..e5544ab456 100644--- a/crates/openhuman-core/src/agent/tinyagents/turn_run_finalize.rs+++ b/crates/openhuman-core/src/agent/tinyagents/turn_run_finalize.rs@@ -39,7 +39,8 @@ pub(super) async fn finalize_turn_outcome(bridge: Option<Arc<OpenhumanEventBridge>>,early_exit_hook: Option<EarlyExitHook>,halt_summary: &HaltSummarySlot,- wrap_up_fired: &Option<Arc<std::sync::atomic::AtomicBool>>,+ wrap_up_fired: &Option<Arc<FinalCallWrapUpMiddleware>>,+ run_instance_id: u64,tool_outcome_sink: &ToolOutcomeSink,resolved_route: Option<tinyinference_llm::model::ResolvedModelRoute>,request_base_len: usize,@@ -206,7 +207,7 @@ pub(super) async fn finalize_turn_outcome(// list) and the loop ran out with nothing final.let wrap_up_injected = wrap_up_fired.as_ref()- .is_some_and(|fired| fired.load(std::sync::atomic::Ordering::SeqCst));+ .is_some_and(|mw| mw.fired_for(run_instance_id));let hit_cap = pause_at_cap&& early_exit.is_none()&& breaker_halt.is_none()diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_runner.rs b/crates/openhuman-core/src/agent/tinyagents/turn_runner.rsindex 28f674cfe2..161e6f41a1 100644--- a/crates/openhuman-core/src/agent/tinyagents/turn_runner.rs+++ b/crates/openhuman-core/src/agent/tinyagents/turn_runner.rs@@ -388,6 +388,7 @@ async fn run_turn_via_tinyagents_inner(run_context.tool_result_artifact_index = tool_result_artifact_index.clone();run_context.tool_outcomes = Some(tool_outcome_sink.clone());let mut ctx = run_context.clone().into_tinyagents(config);+ let run_instance_id = ctx.instance_id();// Assemble the run's store registry: the tool-result artifact index (when// present) and — behind the default-ON session dual-write flag — the// session KV store, so the harness carries a handle to the same@@ -742,6 +743,7 @@ async fn run_turn_via_tinyagents_inner(early_exit_hook,&halt_summary,&wrap_up_fired,+ run_instance_id,&tool_outcome_sink,resolved_route,request_base_len,