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(session_host): stop skipping repair when output satisfies contract
Steven Enamakel906cac17e239
diff --git a/crates/openhuman-core/src/agent/session_host/driver/grounded_close.rs b/crates/openhuman-core/src/agent/session_host/driver/grounded_close.rsindex dabec95c34..7978706332 100644--- a/crates/openhuman-core/src/agent/session_host/driver/grounded_close.rs+++ b/crates/openhuman-core/src/agent/session_host/driver/grounded_close.rs@@ -154,14 +154,10 @@ pub(super) async fn repair_required_output() -> Option<String> {use tinyagents_harness::config as required;- if required::output_satisfies_contract(reply, contract) {- return None;- }-let prompt_history: Vec<tinyinference_llm::message::Message> = history.iter().filter_map(message_to_native_chat_message)- .map(crate::agent::tinyagents::chat_message_to_message)+ .map(|message| crate::agent::tinyagents::chat_message_to_message(&message)).collect();let repair_instruction = wrap_harness_instruction(&required::repair_instruction(contract));let mut on_call_completed = |kind, response: Option<&ModelResponse>| {@@ -172,7 +168,7 @@ pub(super) async fn repair_required_output(model: Some(model),temperature: Some(temperature),max_output_tokens: Some(AGENT_TURN_MAX_OUTPUT_TOKENS),- minimum_harness_phrase_chars: 24,+ minimum_harness_phrase_chars: 1,on_call_completed: Some(&mut on_call_completed),},fallback_placement: tinyagents_harness::close::RequiredOutputFallbackPlacement::Prepend,@@ -278,7 +274,7 @@ pub(super) async fn close_if_needed(let history: Vec<tinyinference_llm::message::Message> = base_history.iter().filter_map(message_to_native_chat_message)- .map(crate::agent::tinyagents::chat_message_to_message)+ .map(|message| crate::agent::tinyagents::chat_message_to_message(&message)).collect();let stop_reason = outcome.breaker_halt.as_deref();let harness_needles = harness_instruction_needles(stop_reason);diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session/prelude.rs b/crates/openhuman-core/src/agent/session_host/runtime_session/prelude.rsindex d208dec0c6..d15c4702e2 100644--- a/crates/openhuman-core/src/agent/session_host/runtime_session/prelude.rs+++ b/crates/openhuman-core/src/agent/session_host/runtime_session/prelude.rs@@ -4,7 +4,7 @@ use super::*;impl OpenHumanTurnPrelude {#[allow(clippy::type_complexity)]- fn current_tool_source(+ pub(super) fn current_tool_source(&self,) -> (Arc<Vec<Box<dyn tinytools::Tool>>>,@@ -26,7 +26,7 @@ impl OpenHumanTurnPrelude {/// The session's deferred set for this turn; see/// `OpenHumanRunContext::deferred_tool_names`.- fn current_deferred_tool_names(&self) -> std::collections::HashSet<String> {+ pub(super) fn current_deferred_tool_names(&self) -> std::collections::HashSet<String> {self.tool_surface.lock().unwrap_or_else(std::sync::PoisonError::into_inner)@@ -34,14 +34,14 @@ impl OpenHumanTurnPrelude {.clone()}- fn replace_tool_surface(&self, surface: OpenHumanTurnToolSurface) {+ pub(super) fn replace_tool_surface(&self, surface: OpenHumanTurnToolSurface) {*self.tool_surface.lock().unwrap_or_else(std::sync::PoisonError::into_inner) = surface;}- async fn prepare(&self, cold: bool) -> Result<TurnPreparation> {+ pub(super) async fn prepare(&self, cold: bool) -> Result<TurnPreparation> {let tools = {let surface = self.tool_surface@@ -91,7 +91,7 @@ impl OpenHumanTurnPrelude {})}- fn build_system_prompt_tiered(&self) -> Result<crate::agent::prompts::TieredPrompt> {+ pub(super) fn build_system_prompt_tiered(&self) -> Result<crate::agent::prompts::TieredPrompt> {use crate::agent::prompts::{PromptContext, PromptTool};let surface = self.tool_surface@@ -165,7 +165,7 @@ impl OpenHumanTurnPrelude {self.prompt_builder.build_tiered(&context)}- fn drain_host_events(&self) -> bool {+ pub(super) fn drain_host_events(&self) -> bool {let mut mutable = self.mutable.lock()@@ -213,7 +213,7 @@ impl OpenHumanTurnPrelude {async fn enrich_request(&self,original_user_message: &str,- turn: &super::types::TurnInputs,+ turn: &super::super::types::TurnInputs,run_context: &mut OpenHumanRunContext,) -> String {let mut context = String::new();@@ -339,7 +339,10 @@ impl OpenHumanTurnPrelude {}}- async fn finalize_after_durable_commit(&self, receipt: &CommitReceipt<OpenHumanRunContext>) {+ pub(super) async fn finalize_after_durable_commit(+ &self,+ receipt: &CommitReceipt<OpenHumanRunContext>,+ ) {self.memory_post_turn(receipt);}}