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: complete session store lifecycle integration
Steven Enamakelda166ad547aa
diff --git a/crates/openhuman-core/src/agent/session_import/live.rs b/crates/openhuman-core/src/agent/session_import/live.rsindex 36827b249f..1dd6aca711 100644--- a/crates/openhuman-core/src/agent/session_import/live.rs+++ b/crates/openhuman-core/src/agent/session_import/live.rs@@ -95,13 +95,9 @@ pub fn dual_write_enabled(config_enabled: bool) -> bool {/// agent's key-value store, whatever the dual-write flag says: there are no/// files to mirror.pub async fn session_kv_store() -> Option<Arc<dyn Store>> {- if crate::agent::session_store::replaces_files() {- if let Some(stores) = crate::agent::session_store::current() {- log::debug!(- "[session-store] registering the host session store's kv on RunContext.stores"- );- return Some(stores.kv);- }+ if let Some(stores) = crate::agent::session_store::current() {+ log::debug!("[session-store] registering the host session store's kv on RunContext.stores");+ return Some(stores.kv);}let cfg = match crate::config::Config::load_or_init().await {Ok(cfg) => cfg,diff --git a/crates/openhuman-core/src/agent/tinyagents/reaper.rs b/crates/openhuman-core/src/agent/tinyagents/reaper.rsindex 91fe6a7ec4..82b91d91f5 100644--- a/crates/openhuman-core/src/agent/tinyagents/reaper.rs+++ b/crates/openhuman-core/src/agent/tinyagents/reaper.rs@@ -21,7 +21,7 @@ pub(crate) async fn reap_orphaned_runs(workspace: &Path) -> usize {// With a host session store the status records live in its stores: sweep// the ones this process's own (default-agent) work wrote there.if let Some(stores) = crate::agent::session_store::current() {- let store = FileStatusStore::new(stores.kv);+ let store = FileStatusStore::over(stores.kv);return tinyagents_harness::observability::reap_orphaned_runs(&store).await;}let store = FileStatusStore::new(open_session_stores(workspace).kv);diff --git a/crates/openhuman-embed/src/runtime/builder.rs b/crates/openhuman-embed/src/runtime/builder.rsindex 69ae19c561..4f3185fbc2 100644--- a/crates/openhuman-embed/src/runtime/builder.rs+++ b/crates/openhuman-embed/src/runtime/builder.rs@@ -347,7 +347,13 @@ impl RuntimeBuilder {let core = Core::from_runtime(Arc::new(runtime));if let Some(session) = self.session {- core.auth().store(session).await?;+ if let Err(error) = core.auth().store(session).await {+ if session_store {+ openhuman_core::agent::session_store::clear();+ openhuman_core::agent::session_store::restore(previous_session_store);+ }+ return Err(error.into());+ }}Ok(Runtime::new(diff --git a/crates/openhuman-embed/src/runtime/mod.rs b/crates/openhuman-embed/src/runtime/mod.rsindex 55a07a5c25..309434d3f8 100644--- a/crates/openhuman-embed/src/runtime/mod.rs+++ b/crates/openhuman-embed/src/runtime/mod.rs@@ -156,7 +156,8 @@ pub(crate) struct CoreGuard {/// Whether this runtime installed the process's session store, which is/// removed with it.session_store: bool,- previous_session_store: Option<Arc<dyn openhuman_core::agent::session_store::SessionStoreProvider>>,+ previous_session_store:+ Option<Arc<dyn openhuman_core::agent::session_store::SessionStoreProvider>>,}impl Drop for CoreGuard {diff --git a/scripts/ci/agent-runtime-boundary-baseline.json b/scripts/ci/agent-runtime-boundary-baseline.jsonindex c9c66e7353..f5a01b87ba 100644--- a/scripts/ci/agent-runtime-boundary-baseline.json+++ b/scripts/ci/agent-runtime-boundary-baseline.json@@ -422,21 +422,21 @@{"rule": "openhuman-task-local","path": "crates/openhuman-core/src/agent/session_host/builder/factory.rs",- "line": 990,+ "line": 987,"text": "let root = crate::agent::turn_workspace::current()?;","occurrence": 1},{"rule": "openhuman-task-local","path": "crates/openhuman-core/src/agent/session_host/runtime_session.rs",- "line": 265,+ "line": 266,"text": "crate::agent::turn_origin::current_is_user_authored().then(|| request.input.text());","occurrence": 1},{"rule": "openhuman-task-local","path": "crates/openhuman-core/src/agent/session_host/runtime_session.rs",- "line": 686,+ "line": 670,"text": "workspace_descriptor: crate::agent::harness::current_parent()","occurrence": 1},@@ -765,7 +765,7 @@{"rule": "openhuman-task-local","path": "crates/openhuman-core/src/inference/provider/openhuman_backend_model.rs",- "line": 497,+ "line": 480,"text": "fn with_thread_id(request: ModelRequest, thread_id: Option<&str>) -> ModelRequest {","occurrence": 1},@@ -1028,6 +1028,13 @@"text": "pub use tinyagents_graph::orchestration::OrchestrationTaskStatus;","occurrence": 1},+ {+ "rule": "openhuman-upstream-reexport",+ "path": "crates/openhuman-core/src/agent/session_store/mod.rs",+ "line": 19,+ "text": "pub use tinyagents_session::port::{AgentStores, SessionStoreProvider};",+ "occurrence": 1+ },{"rule": "openhuman-upstream-reexport","path": "crates/openhuman-core/src/agent/todos/ops.rs",@@ -1084,6 +1091,41 @@"text": "pub use tinyinference_voice::cloud::{CloudTranscribeOptions, CloudTranscribeResult};","occurrence": 1},+ {+ "rule": "openhuman-upstream-reexport",+ "path": "crates/openhuman-embed/src/lib.rs",+ "line": 121,+ "text": "pub use tinyagents_session::port::{",+ "occurrence": 1+ },+ {+ "rule": "openhuman-upstream-reexport",+ "path": "crates/openhuman-embed/src/lib.rs",+ "line": 125,+ "text": "pub use tinyagents_session::testkit::conformance::{",+ "occurrence": 1+ },+ {+ "rule": "openhuman-upstream-reexport",+ "path": "crates/openhuman-embed/src/lib.rs",+ "line": 129,+ "text": "pub use tinyagents_session::transcript::{",+ "occurrence": 1+ },+ {+ "rule": "openhuman-upstream-reexport",+ "path": "crates/openhuman-embed/src/lib.rs",+ "line": 134,+ "text": "pub use tinyagents_session::turn_state::{TurnLifecycle, TurnState};",+ "occurrence": 1+ },+ {+ "rule": "openhuman-upstream-reexport",+ "path": "crates/openhuman-embed/src/lib.rs",+ "line": 136,+ "text": "pub use tinyagents_session::{Result as StoreResult, TinyAgentsError as StoreError};",+ "occurrence": 1+ },{"rule": "tinyagents-moved-symbol-alias","path": "vendor/tinyagents/crates/tinyagents-harness/src/tool/mod.rs",@@ -1423,8 +1465,15 @@{"rule": "tinyagents-upstream-reexport","path": "vendor/tinyagents/crates/tinyagents-session/src/lib.rs",- "line": 97,+ "line": 98,"text": "pub use tinyagents_harness::error::{Result, TinyAgentsError};","occurrence": 1+ },+ {+ "rule": "tinyagents-upstream-reexport",+ "path": "vendor/tinyagents/crates/tinyagents-session/src/port/mod.rs",+ "line": 49,+ "text": "pub use tinyagents_harness::store::{AppendStore, Store};",+ "occurrence": 1}]diff --git a/scripts/ci/check-openhuman-rust-layout.mjs b/scripts/ci/check-openhuman-rust-layout.mjsindex dd71cff37c..dc7939fe31 100644--- a/scripts/ci/check-openhuman-rust-layout.mjs+++ b/scripts/ci/check-openhuman-rust-layout.mjs@@ -38,7 +38,7 @@ const LEGACY_LIMIT_ENTRIES = [// under the general 750 limit, so it needs no exception at all.// The session-todo integration added transcript metadata construction to// this already-exempt composition seam. Keep its allowance exact.- ["crates/openhuman-core/src/agent/session_host/runtime_session.rs", 1489],+ ["crates/openhuman-core/src/agent/session_host/runtime_session.rs", 1477],// Session-host factory still assembles the product's deliberately coupled// provider, security, memory, tool and prompt policy. Generic session// state moved to tinyagents-runtime; this remaining composition is split in