Skip to content

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

feat(orchestration): track background delivery slots and completion owners

Steven Enamakelc3b5c016d4da
diff --git a/crates/openhuman-core/src/agent/orchestration/background_delivery.rs b/crates/openhuman-core/src/agent/orchestration/background_delivery.rs
index eaa719b1de..c1b66c9e04 100644
--- a/crates/openhuman-core/src/agent/orchestration/background_delivery.rs
+++ b/crates/openhuman-core/src/agent/orchestration/background_delivery.rs
@@ -66,7 +66,7 @@ const DEBOUNCE: Duration = Duration::from_secs(3);
const RECOVERY_DELAY: Duration = Duration::from_secs(15);
/// Threads whose delivery turn is in flight — prevents two concurrent turns.
-/// Keyed by [`tenant::profile_key`] of the thread id, for the same reason.
+/// Keyed by [`tenant::profile_key_in`] of the thread id, for the same reason.
fn delivering() -> &'static Mutex<HashSet<String>> {
static D: OnceLock<Mutex<HashSet<String>>> = OnceLock::new();
D.get_or_init(|| Mutex::new(HashSet::new()))
diff --git a/crates/openhuman-core/src/agent/orchestration/background_delivery/slot.rs b/crates/openhuman-core/src/agent/orchestration/background_delivery/slot.rs
index fcaa954620..d2113cb217 100644
--- a/crates/openhuman-core/src/agent/orchestration/background_delivery/slot.rs
+++ b/crates/openhuman-core/src/agent/orchestration/background_delivery/slot.rs
@@ -12,7 +12,7 @@ use crate::core::runtime::DispatchCtx;
/// Dropping it frees both: `release` on an already-settled record is a no-op,
/// so a settled batch is untouched and an abandoned one is claimable again.
pub(super) struct DeliverySlot {
- /// [`tenant::profile_key`] of the thread id.
+ /// [`tenant::profile_key_in`] of the thread id.
pub(super) key: String,
router: Arc<CompletionRouter>,
held: Vec<String>,
diff --git a/crates/openhuman-core/src/agent/orchestration/busy_guard.rs b/crates/openhuman-core/src/agent/orchestration/busy_guard.rs
index 877ecf74ad..5981664c6f 100644
--- a/crates/openhuman-core/src/agent/orchestration/busy_guard.rs
+++ b/crates/openhuman-core/src/agent/orchestration/busy_guard.rs
@@ -9,7 +9,7 @@ use super::background_completions;
use crate::core::runtime::tenant::{self, Tenant};
/// Sessions with a user turn in flight — delivery defers while busy. Keyed by
-/// [`tenant::profile_key`]: two SaaS profiles can share a session id (desktop: bare id).
+/// [`tenant::profile_key_in`]: two SaaS profiles can share a session id (desktop: bare id).
///
/// Each key holds the ids of the live [`TurnBusy`] guards on it, so a replacement
/// turn that starts before the one it interrupted has unwound stays busy when
diff --git a/crates/openhuman-core/src/agent/orchestration/completion_owners.rs b/crates/openhuman-core/src/agent/orchestration/completion_owners.rs
index 3aa475c12c..aecca6f9e2 100644
--- a/crates/openhuman-core/src/agent/orchestration/completion_owners.rs
+++ b/crates/openhuman-core/src/agent/orchestration/completion_owners.rs
@@ -2,7 +2,7 @@
//! bus subscriber that delivers it.
//!
//! The background-completion tables are keyed per profile
-//! (`tenant::profile_key`), but the delivery subscriber
+//! (`tenant::profile_key_in`), but the delivery subscriber
//! ([`super::background_delivery`]) runs off-task with no `CoreContext` scope,
//! so in SaaS it cannot read them. [`record_outcome`] runs inside the user's
//! scope: it notes the profile here under the sub-agent's task id (core-minted,
diff --git a/crates/openhuman-core/src/profiles/surface.rs b/crates/openhuman-core/src/profiles/surface.rs
index ea49ec3940..07da0bdf3b 100644
--- a/crates/openhuman-core/src/profiles/surface.rs
+++ b/crates/openhuman-core/src/profiles/surface.rs
@@ -21,7 +21,7 @@ use crate::core::runtime::is_saas;
/// (their store is the caller's workspace). Their cleanup of detached work is
/// confined to the caller too: running sub-agents are cancelled only in the
/// caller's workspace (`running_subagents::caller_workspace`), background
-/// completions are keyed per profile (`tenant::profile_key`) and web-channel
+/// completions are keyed per profile (`tenant::profile_key_in`) and web-channel
/// sessions per tenant.
pub const USER_METHODS: &[&str] = &[
// Detached-worker controls compare the original worker's captured profile.