Skip to content

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

fix(storage): prevent invocation serial overflow

Steven Enamakel1c0748084eb5
diff --git a/crates/openhuman-core/src/modules/storage_host_invocation.rs b/crates/openhuman-core/src/modules/storage_host_invocation.rs
index 6ed7ae1930..eb2edddc98 100644
--- a/crates/openhuman-core/src/modules/storage_host_invocation.rs
+++ b/crates/openhuman-core/src/modules/storage_host_invocation.rs
@@ -61,7 +61,9 @@ impl InvocationStorageBinding {
let host = connection
.unique_name()
.ok_or_else(|| anyhow::anyhow!("module runtime connection has no unique bus name"))?;
- let serial = NEXT_INVOCATION.fetch_add(1, Ordering::Relaxed);
+ let serial = NEXT_INVOCATION
+ .fetch_update(Ordering::Relaxed, Ordering::Relaxed, |next| next.checked_add(1))
+ .map_err(|_| anyhow::anyhow!("invocation storage address space is exhausted"))?;
let object_root = ObjectPath::new(format!(
"{}/call-{serial}",
tinystoragedrivers_busproxy::INVOCATION_OBJECT_ROOT