Skip to content

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

feat(core): expose debug refcount helper for context agent

Steven Enamakeldc2b58770183
diff --git a/crates/openhuman-core/src/core/runtime/context_agent.rs b/crates/openhuman-core/src/core/runtime/context_agent.rs
index b487f72352..97e0f794d4 100644
--- a/crates/openhuman-core/src/core/runtime/context_agent.rs
+++ b/crates/openhuman-core/src/core/runtime/context_agent.rs
@@ -90,6 +90,8 @@ impl CoreContext {
///
/// A host must not close or evict a tenant while this is `true`: its
/// in-flight tables (turns, queues, caches) live in those slots.
+ pub fn debug_counts(self: &Arc<Self>) -> usize { Arc::strong_count(&self.agent.state) }
+
pub fn tenant_in_use(self: &Arc<Self>) -> bool {
Arc::strong_count(self) > 1 || Arc::strong_count(&self.agent.state) > 1
}
diff --git a/crates/openhuman-core/src/profiles/host.rs b/crates/openhuman-core/src/profiles/host.rs
index e321945e25..a03d87f9a5 100644
--- a/crates/openhuman-core/src/profiles/host.rs
+++ b/crates/openhuman-core/src/profiles/host.rs
@@ -638,7 +638,7 @@ impl ProfileHost {
/// or a turn still running on its context (a detached turn outlives the
/// request that started it).
fn in_use(slot: &Slot) -> bool {
- log::warn!("DBGINUSE slotstate={} ctx={} agentstate={}", Arc::strong_count(&slot.state), Arc::strong_count(&slot.state.context), Arc::strong_count(&slot.state.context.agent_state_arc()));
+ log::warn!("DBGINUSE slotstate={} ctx={} agent={}", Arc::strong_count(&slot.state), Arc::strong_count(&slot.state.context), slot.state.context.debug_counts());
Arc::strong_count(&slot.state) > 1 || slot.state.context.tenant_in_use()
}