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
fix(storage): sweep expiring blobs in module scopes
Steven Enamakeleadcbeba54ff
diff --git a/crates/openhuman-core/src/modules/mod.rs b/crates/openhuman-core/src/modules/mod.rsindex 4974f44dc5..aadbf49dff 100644--- a/crates/openhuman-core/src/modules/mod.rs+++ b/crates/openhuman-core/src/modules/mod.rs@@ -298,6 +298,16 @@ pub async fn import_legacy_tinybox(workspace_dir: &std::path::Path) {/// module's blob storage, once per directory. `ttl` is the configured original/// lifetime. Never fails the caller: an error is logged and the import is/// retried at the next install.+/// Scopes, under the current tenant, that hold expiring blobs written by+/// modules (today TinyJuice's CCR originals), for the blob sweeper. A module+/// whose scope cannot be resolved here is skipped.+pub(crate) fn expiring_blob_module_scopes() -> Vec<crate::storage::Scope> {+ [storage_grant_tinyjuice::MODULE_ID]+ .into_iter()+ .filter_map(|id| storage_host::current_module_scope(id).ok())+ .collect()+}+pub async fn import_legacy_tinyjuice(root: &std::path::Path, ttl: Option<std::time::Duration>) {#[cfg(feature = "modules")]import_once(diff --git a/crates/openhuman-core/src/storage/blob_sweep.rs b/crates/openhuman-core/src/storage/blob_sweep.rsindex a58a1469ea..9ddd68c55e 100644--- a/crates/openhuman-core/src/storage/blob_sweep.rs+++ b/crates/openhuman-core/src/storage/blob_sweep.rs@@ -56,7 +56,17 @@ pub async fn sweep_all(backend: Arc<dyn StorageBackend>) -> u64 {let backend = Arc::clone(&backend);async move {match super::current_scope() {- Ok(scope) => sweep_scope(backend.as_ref(), &scope).await,+ Ok(scope) => {+ // Modules keep their expiring blobs in their own scopes+ // derived from the acting scope (TinyJuice's CCR TTL).+ let mut removed = sweep_scope(backend.as_ref(), &scope).await;+ for module_scope in crate::modules::expiring_blob_module_scopes() {+ if module_scope != scope {+ removed += sweep_scope(backend.as_ref(), &module_scope).await;+ }+ }+ removed+ }Err(error) => {tracing::debug!(%error, "[storage::blob_sweep] no scope for this visit; skipped");0diff --git a/crates/openhuman-core/src/storage/fenced_backend.rs b/crates/openhuman-core/src/storage/fenced_backend.rsindex ac1f2a0ddb..97c1a06a84 100644--- a/crates/openhuman-core/src/storage/fenced_backend.rs+++ b/crates/openhuman-core/src/storage/fenced_backend.rs@@ -105,6 +105,13 @@ impl StorageBackend for FencedBackend {))}+ /// Reclaiming blobs that already read as absent changes nothing a reader+ /// can see, so it needs no fence: it goes straight to the inner driver's+ /// own implementation rather than the trait default over the fenced view.+ async fn sweep_expired_blobs(&self, scope: &Scope) -> Result<u64> {+ self.inner.sweep_expired_blobs(scope).await+ }+fn database(&self, name: &str) -> Result<Arc<dyn StorageBackend>> {Ok(Arc::new(Self {inner: self.inner.database(name)?,