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(web_chat): scope thread session invalidation to the active agent
Steven Enamakel548a6fb95c9e
diff --git a/crates/openhuman-core/src/web_chat/ops/state.rs b/crates/openhuman-core/src/web_chat/ops/state.rsindex 76b6e32e69..e9cce3b44a 100644--- a/crates/openhuman-core/src/web_chat/ops/state.rs+++ b/crates/openhuman-core/src/web_chat/ops/state.rs@@ -100,12 +100,27 @@ pub(crate) fn cancel_in_flight_gracefully(entry: InFlightEntry) -> String {}pub async fn invalidate_thread_sessions(thread_id: &str) {+ // Under an embedded agent only that agent's slot goes: another agent that+ // picked the same thread id keeps its live session. Outside an agent scope+ // (a host-level edit or delete of the thread) every scope's slot goes.+ let active_agent = crate::core::runtime::CoreContext::current()+ .and_then(|context| context.session_agent().map(str::to_owned));let mut sessions = THREAD_SESSIONS.lock().await;- let keys_to_remove: Vec<String> = sessions- .keys()- .filter(|k| thread_id_of_key(k) == Some(thread_id))- .cloned()- .collect();+ let keys_to_remove: Vec<String> = match active_agent {+ Some(_) => {+ let key = key_for(thread_id);+ sessions+ .contains_key(&key)+ .then_some(key)+ .into_iter()+ .collect()+ }+ None => sessions+ .keys()+ .filter(|k| thread_id_of_key(k) == Some(thread_id))+ .cloned()+ .collect(),+ };for key in &keys_to_remove {sessions.remove(key);}diff --git a/crates/openhuman-core/src/web_chat/session.rs b/crates/openhuman-core/src/web_chat/session.rsindex 8063348cf1..16ca30789d 100644--- a/crates/openhuman-core/src/web_chat/session.rs+++ b/crates/openhuman-core/src/web_chat/session.rs@@ -300,11 +300,8 @@ pub(super) fn fingerprint_diff());}if prior.workspace_dir != next.workspace_dir {- diff.push(format!(- "workspace_dir: {} -> {}",- prior.workspace_dir.display(),- next.workspace_dir.display()- ));+ // Paths can carry usernames or tenant ids; log only that it moved.+ diff.push("workspace_dir changed".to_string());}if prior.model_registry_signature != next.model_registry_signature {diff.push(describe_signature_change(