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
refactor(session_host): move deterministic final summary into stop_summary
Steven Enamakelfe445e0a076c
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 066704ec17..a2fc5ea544 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@@ -414,17 +414,7 @@ pub(super) async fn close_if_needed(!records.is_empty(),)} else {- match stop_reason {- Some(reason) => stop_summary::render_stop_summary(&records, reason),- None => {- let summary = product_copy::render_close_results(&records, 4_000);- tinyagents_harness::close::final_summary_with_copy(- &product_copy::OPENHUMAN_CLOSE_COPY,- &summary,- !records.is_empty(),- )- }- }+ stop_summary::deterministic_final_summary(&records, stop_reason)}};diff --git a/crates/openhuman-core/src/agent/session_host/mod.rs b/crates/openhuman-core/src/agent/session_host/mod.rsindex 17b985bc32..7fde9354b0 100644--- a/crates/openhuman-core/src/agent/session_host/mod.rs+++ b/crates/openhuman-core/src/agent/session_host/mod.rs@@ -37,7 +37,7 @@ mod builder;mod builder_config;mod codec;mod driver;-mod product_copy;+pub(crate) mod product_copy;// Tool surface for live voice sessions (`voice::live`).#[cfg(feature = "voice")]mod live_tools;diff --git a/crates/openhuman-core/src/agent/session_host/stop_summary.rs b/crates/openhuman-core/src/agent/session_host/stop_summary.rsindex d399c93b34..e547cd57d1 100644--- a/crates/openhuman-core/src/agent/session_host/stop_summary.rs+++ b/crates/openhuman-core/src/agent/session_host/stop_summary.rs@@ -16,7 +16,7 @@//! locale table can replace [`StopReasonKind::copy`] without touching the//! classification.-use super::turn_checkpoint::CheckpointToolResult;+use tinyagents_harness::close::CloseToolResult as CheckpointToolResult;use tinyagents_harness::turn_stop::TurnStop;/// Longest error line shown for one tool, in characters.@@ -257,6 +257,29 @@ pub(crate) fn render_stop_summary(results: &[CheckpointToolResult], stop_note: &)}+/// Deterministic final fallback using OpenHuman copy and stop classification.+pub(crate) fn deterministic_final_summary(+ results: &[CheckpointToolResult],+ stop_reason: Option<&str>,+) -> String {+ if let Some(reason) = stop_reason {+ return render_stop_summary(results, reason);+ }+ if results.is_empty() {+ return tinyagents_harness::close::final_summary_with_copy(+ &super::product_copy::OPENHUMAN_CLOSE_COPY,+ "",+ false,+ );+ }+ let rendered = super::product_copy::render_close_results(results, 4_000);+ tinyagents_harness::close::final_summary_with_copy(+ &super::product_copy::OPENHUMAN_CLOSE_COPY,+ &rendered,+ true,+ )+}+#[cfg(test)]#[path = "stop_summary_tests.rs"]mod tests;diff --git a/crates/openhuman-core/src/agent/session_host/stop_summary_tests.rs b/crates/openhuman-core/src/agent/session_host/stop_summary_tests.rsindex 8c5d96ada0..66fde7b223 100644--- a/crates/openhuman-core/src/agent/session_host/stop_summary_tests.rs+++ b/crates/openhuman-core/src/agent/session_host/stop_summary_tests.rs@@ -1,7 +1,5 @@use super::*;-use crate::agent::session_host::turn_checkpoint::{- build_deterministic_final_summary, CheckpointToolResult,-};+use tinyagents_harness::close::CloseToolResult as CheckpointToolResult;fn result(name: &str, success: bool, content: &str) -> CheckpointToolResult {CheckpointToolResult {@@ -19,7 +17,7 @@ const TRANSIENT_HALT: &str = "Stopping after 3 attempt(s): failure class `transi/// whose raw body carried the user's email and IP.#[test]fn a_halted_turn_gives_one_reason_and_collapses_identical_failures() {- let out = build_deterministic_final_summary(+ let out = deterministic_final_summary(&[result("get_profile",@@ -64,7 +62,7 @@ fn a_halted_turn_gives_one_reason_and_collapses_identical_failures() {#[test]fn an_error_line_is_scrubbed_of_identifiers_and_truncated() {let long_tail = "x".repeat(400);- let out = build_deterministic_final_summary(+ let out = deterministic_final_summary(&[result("send_report",@@ -92,7 +90,7 @@ fn an_error_line_is_scrubbed_of_identifiers_and_truncated() {#[test]fn a_secret_in_an_error_line_is_not_repeated() {- let out = build_deterministic_final_summary(+ let out = deterministic_final_summary(&[result("http_request",false,@@ -112,7 +110,7 @@ fn a_secret_in_an_error_line_is_not_repeated() {#[test]fn a_successful_repeat_halt_does_not_claim_failure() {- let out = build_deterministic_final_summary(+ let out = deterministic_final_summary(&[result("list_items", true, "3 items"),result("list_items", true, "3 items"),@@ -213,7 +211,7 @@ fn a_capped_summary_keeps_the_most_recent_groups() {.map(|i| result(&format!("early_tool_{i}"), true, "ok")).collect();results.push(result("final_blocker", false, "boom happened"));- let out = build_deterministic_final_summary(&results, Some(TRANSIENT_HALT));+ let out = deterministic_final_summary(&results, Some(TRANSIENT_HALT));assert!(out.contains("final_blocker"), "{out}");assert!(!out.contains("early_tool_0`"), "{out}");assert!(out.contains("more tool call(s)"), "{out}");diff --git a/crates/openhuman-core/src/agent/tinyagents/middleware_stop_cause_tests.rs b/crates/openhuman-core/src/agent/tinyagents/middleware_stop_cause_tests.rsindex 9c1dfdaef4..3be59fa720 100644--- a/crates/openhuman-core/src/agent/tinyagents/middleware_stop_cause_tests.rs+++ b/crates/openhuman-core/src/agent/tinyagents/middleware_stop_cause_tests.rs@@ -5,7 +5,7 @@use super::*;use crate::agent::session_host::stop_summary::{render_stop_summary, StopReasonKind};-use crate::agent::session_host::turn_checkpoint::CheckpointToolResult;+use tinyagents_harness::close::CloseToolResult as CheckpointToolResult;use crate::agent::tinyagents::middleware::repeated_failure::RepeatedToolFailureMiddleware;use tinyagents_harness::middleware::is_repeat_call_exempt;use tinyagents_harness::middleware::library::{diff --git a/crates/openhuman-core/src/agent_registry/agents/fleet_prompt_tests.rs b/crates/openhuman-core/src/agent_registry/agents/fleet_prompt_tests.rsindex a1698d66f0..f1236da245 100644--- a/crates/openhuman-core/src/agent_registry/agents/fleet_prompt_tests.rs+++ b/crates/openhuman-core/src/agent_registry/agents/fleet_prompt_tests.rs@@ -497,7 +497,13 @@ async fn every_prompt_names_at_least_one_tool_it_can_call() {/// are reworded, that judge silently grades against a different standard.#[test]fn close_verification_rubric_keeps_its_three_rules() {- let rubric = crate::agent::session_host::turn_checkpoint::close_verification_prompt("", "", "");+ let rubric = tinyagents_harness::close::verification_prompt(+ &crate::agent::session_host::product_copy::OPENHUMAN_CLOSE_COPY,+ "",+ "",+ "",+ 4_000,+ );for stem in ["1. The reply only says what the assistant will do","2. The reply states something the tool records contradict",