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(runtime): prevent thread id change after session init
Steven Enamakela688a4692842
diff --git a/crates/openhuman-core/src/agent/session_host/runtime/accessors.rs b/crates/openhuman-core/src/agent/session_host/runtime/accessors.rsindex 75510f46eb..5fb0948f90 100644--- a/crates/openhuman-core/src/agent/session_host/runtime/accessors.rs+++ b/crates/openhuman-core/src/agent/session_host/runtime/accessors.rs@@ -275,10 +275,18 @@ impl OpenHumanSessionHost {/// transcript, and it inherits its parent's thread id only for/// correlation.pub fn set_thread_id(&mut self, thread_id: Option<impl AsRef<str>>) {- self.thread_id = thread_id.and_then(|thread_id| {+ let thread_id = thread_id.and_then(|thread_id| {let thread_id = thread_id.as_ref().trim();(!thread_id.is_empty()).then(|| thread_id.to_owned())});+ // The runtime session caches its prompt and declaration snapshot from+ // the first turn. Changing identity after that would desynchronize+ // thread-scoped tools from the cached session state.+ if self.runtime_session.is_some() && thread_id != self.thread_id {+ tracing::warn!("cannot change thread id after runtime session initialization");+ return;+ }+ self.thread_id = thread_id;self.session = match (&self.thread_id, self.session_parent_prefix.is_some()) {(Some(thread_id), false) => Some(tinyagents_session::transcript::SessionRef::scoped(thread_id.clone(),diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session.rs b/crates/openhuman-core/src/agent/session_host/runtime_session.rsindex 7e631f90dc..59d30c20ff 100644--- a/crates/openhuman-core/src/agent/session_host/runtime_session.rs+++ b/crates/openhuman-core/src/agent/session_host/runtime_session.rs@@ -230,18 +230,18 @@ impl OpenHumanTurnPrelude {surface.visible_tool_specs.iter()- .filter(|spec| {- self.thread_id.is_some()- || !crate::agent::tinyagents::harness_tool_registration::is_thread_goal_tool(- &spec.name,- )- }).chain(surface.tool_specs.iter().filter(|spec| surface.deferred_tool_names.contains(&spec.name)),)+ .filter(|spec| {+ self.thread_id.is_some()+ || !crate::agent::tinyagents::harness_tool_registration::is_thread_goal_tool(+ &spec.name,+ )+ }).map(|spec| spec.as_ref().clone()).collect(),)