Skip to content

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

fix(profiles): log pinned strong counts when profile slots are full

Steven Enamakele2ef3f5b6f92
diff --git a/crates/openhuman-core/src/profiles/host.rs b/crates/openhuman-core/src/profiles/host.rs
index 896124bfd4..b541741dc8 100644
--- a/crates/openhuman-core/src/profiles/host.rs
+++ b/crates/openhuman-core/src/profiles/host.rs
@@ -258,13 +258,31 @@ impl ProfileHost {
{
return Err(OpenError::NotProvisioned(id.clone()));
}
- let (closed, full) = {
+ let (closed, full, pinned) = {
let mut open = self.lock();
let closed = self.evict_locked(&mut open, Instant::now());
- (closed, open.len() >= self.saas.max_profiles_open.max(1))
+ let pinned = open
+ .values()
+ .filter(|slot| in_use(slot))
+ .map(|slot| {
+ (
+ Arc::strong_count(&slot.state),
+ Arc::strong_count(&slot.state.context),
+ Arc::strong_count(&slot.state.context.agent.state),
+ )
+ })
+ .collect::<Vec<_>>();
+ (
+ closed,
+ open.len() >= self.saas.max_profiles_open.max(1),
+ pinned,
+ )
};
profile_lease::release_all(self, closed).await;
if full {
+ log::debug!(
+ "[profiles] no free profile slot; pinned strong counts (profile, context, agent_state)={pinned:?}"
+ );
return Err(OpenError::Full {
max: self.saas.max_profiles_open,
});