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(subagent_host): resolve sub-agent transcripts from the carried context
Steven Enamakelc856aa8b5dcb
diff --git a/crates/openhuman-core/src/agent/session_store/mod.rs b/crates/openhuman-core/src/agent/session_store/mod.rsindex 39f6756bb4..b62d32a1b3 100644--- a/crates/openhuman-core/src/agent/session_store/mod.rs+++ b/crates/openhuman-core/src/agent/session_store/mod.rs@@ -139,6 +139,34 @@ pub fn transcripts_or_files(transcripts_for(agent_id).unwrap_or_else(|| workspace_transcripts(agent_id, workspace_dir))}+/// [`transcripts_or_files`] for the store `core` selects, never the ambient+/// context's: `core`'s own host-override provider, else the installed one,+/// else the workspace's store. For work that carries its context explicitly+/// (a detached sub-agent on a bare `tokio::spawn`, which has no ambient one).+#[must_use]+pub fn transcripts_or_files_in(+ core: &crate::core::runtime::CoreContext,+ agent_id: &str,+ workspace_dir: &std::path::Path,+) -> Arc<dyn tinyagents_session::transcript::TranscriptLocator> {+ let provider = core+ .host_overrides()+ .and_then(|overrides| overrides.session_store.clone())+ .or_else(|| {+ PROVIDER+ .read()+ .unwrap_or_else(PoisonError::into_inner)+ .clone()+ });+ match provider {+ Some(provider) => {+ log::debug!("[session_store] transcripts via the carried context's store agent={agent_id}");+ provider.for_agent(agent_id).transcripts+ }+ None => workspace_transcripts(agent_id, workspace_dir),+ }+}+/// The workspace stores this process holds open, so repeat lookups share one/// backend ([`release_workspace_stores`] drops them for a data reset).static OPEN_WORKSPACE_STORES: LazyLock<diff --git a/crates/openhuman-core/src/agent/subagent_host/ops/graph/transcript.rs b/crates/openhuman-core/src/agent/subagent_host/ops/graph/transcript.rsindex b47cc59b29..c778d15416 100644--- a/crates/openhuman-core/src/agent/subagent_host/ops/graph/transcript.rs+++ b/crates/openhuman-core/src/agent/subagent_host/ops/graph/transcript.rs@@ -46,33 +46,58 @@ pub(super) fn failed_run_history(/// The store a sub-agent's transcript goes to: the turn tree's own/// ([`OpenHumanRunContext::transcripts`], set by the root session), so it lands/// beside its parent's under the same key. A run no session started falls-/// back to the store of the run's own context, keyed like the parent-/// session's (its definition id, or the default agent).+/// back to the store its own carried context selects, keyed like the parent+/// session's (its definition id, or the default agent). That context's store+/// is used explicitly: a detached run is a bare `tokio::spawn` with no ambient+/// one.+///+/// A SaaS process whose carried context is gone has no tenant to scope to, so+/// the run gets an isolated in-memory store instead of the operator's.pub(super) fn subagent_transcripts(run_context: &OpenHumanRunContext,workspace_dir: &std::path::Path,+) -> Arc<dyn TranscriptLocator> {+ subagent_transcripts_in(run_context, workspace_dir, crate::core::runtime::is_saas())+}++pub(super) fn subagent_transcripts_in(+ run_context: &OpenHumanRunContext,+ workspace_dir: &std::path::Path,+ saas: bool,) -> Arc<dyn TranscriptLocator> {if let Some(transcripts) = run_context.transcripts.clone() {return transcripts;}- let tenant = run_context- .core- .as_ref()- .and_then(std::sync::Weak::upgrade)- .map(|core| crate::core::runtime::Tenant::of(&core))- .unwrap_or_default();+ let core = run_context.core.as_ref().and_then(std::sync::Weak::upgrade);let fallback = run_context.parent.as_ref().map_or(crate::agent::session_store::DEFAULT_AGENT, |parent| {parent.agent_definition_id.as_str()});+ let Some(core) = core else {+ if saas {+ tracing::warn!(+ "[subagent_host:graph] no turn-tree store and no carried context in SaaS mode; \+ transcript kept in memory only"+ );+ return tinyagents_session::port::InMemorySessionStores::new()+ .for_agent(fallback)+ .transcripts;+ }+ let key = crate::agent::session_store::agent_key_for(+ &crate::core::runtime::Tenant::default(),+ fallback,+ );+ return crate::agent::session_store::transcripts_or_files(&key, workspace_dir);+ };+ let tenant = crate::core::runtime::Tenant::of(&core);let key = crate::agent::session_store::agent_key_for(&tenant, fallback);tracing::debug!(profile = tenant.profile.is_some(),- "[subagent_host:graph] no turn-tree transcript store; using the run context's"+ "[subagent_host:graph] no turn-tree transcript store; using the carried context's");- crate::agent::session_store::transcripts_or_files(&key, workspace_dir)+ crate::agent::session_store::transcripts_or_files_in(&core, &key, workspace_dir)}/// Persist a sub-agent turn's raw transcript to `transcripts` under