Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

feat(session_host): add optional session reference for durable thread identity

Steven Enamakelec4ce464a509
diff --git a/crates/openhuman-core/src/agent/session_host/builder/builder_build.rs b/crates/openhuman-core/src/agent/session_host/builder/builder_build.rs
index 7ef862982f..6b906a08d5 100644
--- a/crates/openhuman-core/src/agent/session_host/builder/builder_build.rs
+++ b/crates/openhuman-core/src/agent/session_host/builder/builder_build.rs
@@ -373,6 +373,7 @@ impl SessionHostBuilder {
format!("{unix_ts}_{sanitized}")
},
session_parent_prefix: self.session_parent_prefix,
+ session: None,
context: std::sync::Arc::new(std::sync::Mutex::new(context)),
on_progress: None,
run_queue: None,
diff --git a/crates/openhuman-core/src/agent/session_host/types.rs b/crates/openhuman-core/src/agent/session_host/types.rs
index d0dd85dcea..de1a4abe7d 100644
--- a/crates/openhuman-core/src/agent/session_host/types.rs
+++ b/crates/openhuman-core/src/agent/session_host/types.rs
@@ -289,6 +289,16 @@ pub struct OpenHumanSessionHost {
/// `Some("1713000000_orchestrator/1713000123_planner")` so nested
/// delegations produce a tree on disk.
pub(super) session_parent_prefix: Option<String>,
+ /// Durable identity of the conversation this root session serves.
+ ///
+ /// Set by [`set_thread_id`][super::runtime::accessors] once the host knows
+ /// the thread, and `None` for a sub-agent or an unthreaded session. When
+ /// present it, not [`Self::session_key`], addresses the transcript: the
+ /// stem it derives carries no timestamp, so every restart and every
+ /// process resolves the same conversation to the same file. The
+ /// timestamped `session_key` remains correct for sub-agents, where each
+ /// spawn genuinely is a new transcript.
+ pub(super) session: Option<tinyagents_session::transcript::SessionRef>,
/// Per-session [`ContextManager`] — owns the system-prompt
/// builder, the layered reduction pipeline (tool-result budget →
/// microcompact → autocompact signal → session-memory extraction