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): use injected transcript stem for resumed sessions
Steven Enamakeldf03fe0696d6
diff --git a/crates/openhuman-core/src/agent/session_host/driver/helpers.rs b/crates/openhuman-core/src/agent/session_host/driver/helpers.rsindex 44948d4fb8..b3ec05ea05 100644--- a/crates/openhuman-core/src/agent/session_host/driver/helpers.rs+++ b/crates/openhuman-core/src/agent/session_host/driver/helpers.rs@@ -116,7 +116,8 @@ pub(super) fn driver_error_with_snapshot(// indefinitely. Preserve the completed tools as a useful, bounded// partial rather than showing only the failed model's process text.let results = crate::agent::session_host::product_copy::close_results(&guard.tool_outcomes);- let evidence = crate::agent::session_host::product_copy::render_close_results(&results, 4_000);+ let evidence =+ crate::agent::session_host::product_copy::render_close_results(&results, 4_000);format!("I stopped a repetitive model response before it could finish. Here are the completed tool results I can report:\n{evidence}")diff --git a/crates/openhuman-core/src/agent/session_host/product_copy_tests.rs b/crates/openhuman-core/src/agent/session_host/product_copy_tests.rsindex e0ce290e58..96a622e4ff 100644--- a/crates/openhuman-core/src/agent/session_host/product_copy_tests.rs+++ b/crates/openhuman-core/src/agent/session_host/product_copy_tests.rs@@ -1,4 +1,4 @@-use super::{OPENHUMAN_CLOSE_COPY, close_results, render_close_results};+use super::{close_results, render_close_results, OPENHUMAN_CLOSE_COPY};type CheckpointToolResult = tinyagents_harness::close::CloseToolResult;const CHECKPOINT_TOTAL_CHARS: usize = 4_000;@@ -245,13 +245,11 @@ const STOP_NOTE: &str = "Stopping: the `install_item` call was retried 3 times w/// request was not done.#[test]fn the_final_summary_quotes_each_failure_message() {- let out = build_deterministic_final_summary(- &[result(- "install_item",- false,- "no direct download. View it at https://example.test/demo",- )],- );+ let out = build_deterministic_final_summary(&[result(+ "install_item",+ false,+ "no direct download. View it at https://example.test/demo",+ )]);assert!(out.contains("`install_item` — failed"),"status missing: {out}"diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session.rs b/crates/openhuman-core/src/agent/session_host/runtime_session.rsindex bea715cf29..6dd2b90afc 100644--- a/crates/openhuman-core/src/agent/session_host/runtime_session.rs+++ b/crates/openhuman-core/src/agent/session_host/runtime_session.rs@@ -15,10 +15,10 @@ mod prompt_surface;#[path = "runtime_session_usage.rs"]mod usage;pub(super) use usage::{account_committed_turn_against_goal, holistic_last_turn_usage};+mod identity;#[path = "../../memory/lifecycle/session_hooks.rs"]mod session_hooks;mod tool_rules;-mod identity;#[path = "runtime_session_turn.rs"]mod turn;pub(super) use turn::begin_turn_resume;@@ -313,19 +313,21 @@ impl OpenHumanSessionHost {// turns keep the per-run stem path. Reuse one locator for the initial// binding and each resume because the runtime compares locator identity.let injected_locator = self.session_history_locator.clone();- let resume_target = injected_locator.as_ref().map(|locator| match self.session.clone() {- Some(session) => TranscriptTarget::for_session(- Arc::clone(locator),- session,- self.runtime_transcript_meta(),- ),- None => TranscriptTarget::new(- Arc::clone(locator),- self.runtime_transcript_stem(),- self.runtime_transcript_meta(),- )- .with_resume_agent(self.agent_definition_name.clone()),- });+ let resume_target = injected_locator+ .as_ref()+ .map(|locator| match self.session.clone() {+ Some(session) => TranscriptTarget::for_session(+ Arc::clone(locator),+ session,+ self.runtime_transcript_meta(),+ ),+ None => TranscriptTarget::new(+ Arc::clone(locator),+ self.injected_transcript_stem(),+ self.runtime_transcript_meta(),+ )+ .with_resume_agent(self.agent_definition_name.clone()),+ });{let mut state = self.runtime_state@@ -553,7 +555,7 @@ impl OpenHumanSessionHost {match self.session.clone() {Some(session) => builder.session(locator, session, meta),None => builder- .transcript(locator, self.runtime_transcript_stem(), meta)+ .transcript(locator, self.injected_transcript_stem(), meta).resume_agent(self.agent_definition_name.clone()),}} else {diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session/identity.rs b/crates/openhuman-core/src/agent/session_host/runtime_session/identity.rsindex 2c6fb7717a..972d965a46 100644--- a/crates/openhuman-core/src/agent/session_host/runtime_session/identity.rs+++ b/crates/openhuman-core/src/agent/session_host/runtime_session/identity.rs@@ -11,6 +11,13 @@ use super::super::types::OpenHumanSessionHost;use crate::agent::tinyagents::host::OpenHumanRunContext;impl OpenHumanSessionHost {+ pub(super) fn injected_transcript_stem(&self) -> String {+ match &self.session_parent_prefix {+ Some(prefix) => format!("{prefix}__{}", self.session_key),+ None => self.session_key.clone(),+ }+ }+pub(super) fn runtime_session_key(&self) -> String {self.thread_id.clone()diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session_turn.rs b/crates/openhuman-core/src/agent/session_host/runtime_session_turn.rsindex 6dc9a91d4b..7116dbcdfa 100644--- a/crates/openhuman-core/src/agent/session_host/runtime_session_turn.rs+++ b/crates/openhuman-core/src/agent/session_host/runtime_session_turn.rs@@ -116,7 +116,10 @@ impl OpenHumanSessionHost {}),thread_id: self.thread_id.clone(),stream: self.on_progress.is_some(),- session: self.session.clone(),+ session: self+ .session_history_locator+ .as_ref()+ .and(self.session.clone()),resume: self.turn_resume_mode(),cancellation: cancellation.clone(),run_context: context.into_tinyagents(root_config),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 3be59fa720..1a210eb460 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,8 +5,8 @@use super::*;use crate::agent::session_host::stop_summary::{render_stop_summary, StopReasonKind};-use tinyagents_harness::close::CloseToolResult as CheckpointToolResult;use crate::agent::tinyagents::middleware::repeated_failure::RepeatedToolFailureMiddleware;+use tinyagents_harness::close::CloseToolResult as CheckpointToolResult;use tinyagents_harness::middleware::is_repeat_call_exempt;use tinyagents_harness::middleware::library::{RepeatProgressMiddleware, DEFAULT_CLEARED_PLACEHOLDER, REPEAT_GUARD_BLOCKED,diff --git a/crates/openhuman-core/src/storage/sessions/tenant_router.rs b/crates/openhuman-core/src/storage/sessions/tenant_router.rsindex 39416a478b..54c197d5f9 100644--- a/crates/openhuman-core/src/storage/sessions/tenant_router.rs+++ b/crates/openhuman-core/src/storage/sessions/tenant_router.rs@@ -13,7 +13,9 @@ use std::collections::HashMap;use std::sync::{Arc, Mutex, PoisonError};use tinyagents_harness::store::SchemaAdmission;-use tinyagents_session::port::{AgentStores, SessionStoreLease, SessionStoreLeaseError, SessionStoreProvider};+use tinyagents_session::port::{+ AgentStores, SessionStoreLease, SessionStoreLeaseError, SessionStoreProvider,+};use tinyagents_session::DriverSessionStores;use tinystoragedrivers::{Blocking, Scope, StorageBackend, StorageError};@@ -130,10 +132,7 @@ impl SessionStoreProvider for TenantSessionStores {provider.try_for_agent(&agent)}- fn lease_for_agent(- &self,- agent_id: &str,- ) -> Result<SessionStoreLease, SessionStoreLeaseError> {+ fn lease_for_agent(&self, agent_id: &str) -> Result<SessionStoreLease, SessionStoreLeaseError> {let (provider, agent) = self.route(agent_id);provider.lease_for_agent(&agent)}