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
feat(session-host): use typed stop cause for halted-turn summaries
Steven Enamakelb274c2aa491c
diff --git a/crates/openhuman-core/src/agent/session_host/driver/grounded_close_tests.rs b/crates/openhuman-core/src/agent/session_host/driver/grounded_close_tests.rsindex 6ab285e548..c040d55864 100644--- a/crates/openhuman-core/src/agent/session_host/driver/grounded_close_tests.rs+++ b/crates/openhuman-core/src/agent/session_host/driver/grounded_close_tests.rs@@ -157,6 +157,26 @@ fn classified_halt_summary_uses_typed_class_for_translated_notes() {}}+#[test]+fn unrecognized_typed_class_does_not_fall_back_to_english_halt_phrases() {+ let outcome = classified_halt(+ "Stopping: the action is blocked by the security policy.",+ "future_failure_class",+ );+ let close = classified_halt_close(&outcome).expect("typed halt");++ assert!(+ close.output.contains("my tool calls were not getting anywhere"),+ "unknown typed classes use generic copy instead of parsing halt prose: {}",+ close.output+ );+ assert!(+ !close.output.contains("security settings"),+ "English halt wording cannot override a typed class: {}",+ close.output+ );+}+/// The host adapter delegates generation and verification to TinyAgents while/// retaining its selected model, temperature, output cap and billing gauge.#[tokio::test]diff --git a/crates/openhuman-core/src/agent/session_host/stop_summary.rs b/crates/openhuman-core/src/agent/session_host/stop_summary.rsindex 0baadea0f3..2a5ba971fb 100644--- a/crates/openhuman-core/src/agent/session_host/stop_summary.rs+++ b/crates/openhuman-core/src/agent/session_host/stop_summary.rs@@ -212,6 +212,8 @@ impl StopReasonKind {"validation" | "invalid_arguments" => Self::InvalidCalls,"unavailable" | "service_refused" => Self::Unavailable,"site_refused" => Self::SiteRefused,+ "out_of_credits" => Self::OutOfCredits,+ "provider_config" => Self::ProviderConfig,_ => Self::Generic,}}@@ -262,7 +264,19 @@ fn times(count: usize) -> String {/// The user-facing reply for a turn the breaker stopped with `stop_note`.pub(crate) fn render_stop_summary(results: &[CheckpointToolResult], stop_note: &str) -> String {- let kind = StopReasonKind::from_stop_note(stop_note);+ render_stop_summary_with_cause(results, stop_note, None)+}++/// Render a stopped-turn summary from its typed cause when the harness has+/// one. The note is only a compatibility source for old, untyped stops.+pub(crate) fn render_stop_summary_with_cause(+ results: &[CheckpointToolResult],+ stop_note: &str,+ failure_cause: Option<&tinyagents_harness::no_progress::ClassifiedStopCause>,+) -> String {+ let kind = failure_cause+ .map(|cause| StopReasonKind::from_failure_class(&cause.class))+ .unwrap_or_else(|| StopReasonKind::from_stop_note(stop_note));tracing::debug!(reason = kind.key(),results = results.len(),diff --git a/crates/openhuman-core/src/agent/session_host/turn_checkpoint.rs b/crates/openhuman-core/src/agent/session_host/turn_checkpoint.rsindex 3d33e2a080..569c6fba24 100644--- a/crates/openhuman-core/src/agent/session_host/turn_checkpoint.rs+++ b/crates/openhuman-core/src/agent/session_host/turn_checkpoint.rs@@ -508,12 +508,26 @@ pub(crate) fn close_verification_prompt(user_request: &str, records: &str, replypub(crate) fn build_deterministic_final_summary(results: &[CheckpointToolResult],stop_reason: Option<&str>,+) -> String {+ build_deterministic_final_summary_with_cause(results, stop_reason, None)+}++/// Build a stopped-turn summary using its typed breaker cause when available.+/// The note remains a compatibility source for old, untyped stops.+pub(crate) fn build_deterministic_final_summary_with_cause(+ results: &[CheckpointToolResult],+ stop_reason: Option<&str>,+ failure_cause: Option<&tinyagents_harness::no_progress::ClassifiedStopCause>,) -> String {if results.is_empty() && stop_reason.is_none() {return "I finished this turn but produced no result to report.".to_string();}if let Some(reason) = stop_reason {- return super::stop_summary::render_stop_summary(results, reason);+ return super::stop_summary::render_stop_summary_with_cause(+ results,+ reason,+ failure_cause,+ );}let mut out = String::from("I finished this turn without writing up a result. Here is what each tool call returned:\n",