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
refactor(orchestration): drop stale completion router on store reopen
Steven Enamakel6e7c0bd80aa5
diff --git a/crates/openhuman-core/src/agent/orchestration/background_completions.rs b/crates/openhuman-core/src/agent/orchestration/background_completions.rsindex 0f913193c1..f5701695c9 100644--- a/crates/openhuman-core/src/agent/orchestration/background_completions.rs+++ b/crates/openhuman-core/src/agent/orchestration/background_completions.rs@@ -30,7 +30,7 @@ pub(crate) use parent_lifecycle::{clear_all, delete_parent_for_thread, discard_for_thread, discard_pending_for_thread,finish_stop_for_thread, mark_stopped_task_if_thread_stopped, resume_stopped_thread,};-pub(crate) use store_adapter::{release_profile_workspace, router_for_workspace_ctx};+pub(crate) use store_adapter::router_for_workspace_ctx;pub(super) use store_adapter::{degrade_to_memory, entry_for_ctx, open_driver_store, router_pool, router_scope_for,};diff --git a/crates/openhuman-core/src/agent/orchestration/background_completions/store_adapter.rs b/crates/openhuman-core/src/agent/orchestration/background_completions/store_adapter.rsindex b02d287832..06d47aa7ad 100644--- a/crates/openhuman-core/src/agent/orchestration/background_completions/store_adapter.rs+++ b/crates/openhuman-core/src/agent/orchestration/background_completions/store_adapter.rs@@ -250,29 +250,3 @@ pub(in crate::agent::orchestration) fn router_for_workspace() -> Arc<CompletionRouter> {router_for_workspace_ctx(&DispatchCtx::ambient(), workspace_dir)}--/// Drops the cached completion router and store sidecar of profile `profile`'s-/// `workspace_dir`, after the profile's lease was released. The cached driver-/// store captured the old lease epoch's fence, so a later open of the same-/// profile (a new epoch) would otherwise keep failing with-/// `lease fence: key lost`. Handles already handed out stay fenced.-pub(crate) fn release_profile_workspace(profile: &str, workspace_dir: &Path) {- let tenant = crate::core::runtime::Tenant {- profile: Some(profile.to_owned()),- agent: None,- };- let scope = RouterScope {- profile_key: crate::core::runtime::tenant::profile_key_in(&tenant, ""),- workspace_dir: workspace_dir.to_path_buf(),- };- match router_pool().remove(&scope) {- Ok(removed) => log::debug!(- "[background_completions] released profile={profile} router_cached={}",- removed.is_some()- ),- Err(error) => {- log::warn!("[background_completions] release profile={profile} failed: {error}");- }- }- state().stores.remove(&scope);-}diff --git a/crates/openhuman-core/src/agent/orchestration/completion_target.rs b/crates/openhuman-core/src/agent/orchestration/completion_target.rsindex 2cf73a1594..3370555f5a 100644--- a/crates/openhuman-core/src/agent/orchestration/completion_target.rs+++ b/crates/openhuman-core/src/agent/orchestration/completion_target.rs@@ -195,6 +195,15 @@ pub(crate) fn forget_recovery_ctx(ctx: &crate::core::runtime::DispatchCtx, works"[background_completions] could not reopen durable completion store workspace_dir={} error={error:#}",workspace_dir.display());+ // The cached store captured the previous lease epoch's fence, so the+ // swap cannot read its records back and every later call through+ // this router would keep failing with `lease fence: key lost`. Drop+ // the router so the next lookup opens a fresh one at the current+ // epoch; the durable records stay in the backend, and admissions the+ // old router handed out keep working through the pool's parent+ // lifecycle authority.+ let _ = super::background_completions::router_pool().remove(&scope);+ state().stores.remove(&scope);}}}diff --git a/crates/openhuman-core/src/profiles/lease.rs b/crates/openhuman-core/src/profiles/lease.rsindex 8dd3a58e5b..48b4a2ed39 100644--- a/crates/openhuman-core/src/profiles/lease.rs+++ b/crates/openhuman-core/src/profiles/lease.rs@@ -138,10 +138,6 @@ pub(crate) fn release_profile_stores(host: &ProfileHost, id: &ProfileId) {crate::storage::sessions::release_profile(id.as_str());let workspace = host.layout_of(id).workspace_dir;crate::storage::sessions::release_workspace(&workspace);- crate::agent::orchestration::background_completions::release_profile_workspace(- id.as_str(),- &workspace,- );}/// What one renewal pass did.