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): return invalidated session count from thread invalidation
Steven Enamakel83765d3ce24d
diff --git a/crates/openhuman-core/src/web_chat/ops/state.rs b/crates/openhuman-core/src/web_chat/ops/state.rsindex 2f3e79e51f..9397dba5b1 100644--- a/crates/openhuman-core/src/web_chat/ops/state.rs+++ b/crates/openhuman-core/src/web_chat/ops/state.rs@@ -128,7 +128,7 @@ pub(crate) fn cancel_in_flight_gracefully(entry: InFlightEntry) -> String {request_id}-pub async fn invalidate_thread_sessions(ctx: &DispatchCtx, thread_id: &str) {+pub async fn invalidate_thread_sessions(ctx: &DispatchCtx, thread_id: &str) -> usize {// Under an embedded agent or a profile only that tenant's entry goes.// Outside both every entry for the thread in the current table goes.let tenant = tenant_of(ctx);@@ -158,6 +158,7 @@ pub async fn invalidate_thread_sessions(ctx: &DispatchCtx, thread_id: &str) {thread_id);}+ keys_to_remove.len()}/// Invalidate only the captured tenant, unless its channel session ended.diff --git a/tests/agent_harness_e2e.rs b/tests/agent_harness_e2e.rsindex 057de34c09..edfc2bb990 100644--- a/tests/agent_harness_e2e.rs+++ b/tests/agent_harness_e2e.rs@@ -1139,11 +1139,15 @@ async fn run_managed_capture_turn(// The bare test router dispatches RPC with DispatchCtx::unbound(). Its// cached web-chat agent outlives a router shutdown, so remove that session// from the same process-default slot before the fixture resets its files.- openhuman_core::web_chat::invalidate_thread_sessions(+ let invalidated = openhuman_core::web_chat::invalidate_thread_sessions(&openhuman_core::core::runtime::DispatchCtx::unbound(),"managed-capture-thread",).await;+ assert_eq!(+ invalidated, 1,+ "the completed managed turn must leave one cached session to invalidate"+ );// Session transcript stores and their SQLite backend are also cached by// workspace path; release them before the next repetition removes it.openhuman_core::storage::sessions::release_workspace(&workspace_dir);