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
chore: files changed crates/openhuman-core/src/memory/state_store.rs,crates/openhuman-core/src/memor
Steven Enamakel5843da2a5f37
diff --git a/crates/openhuman-core/src/memory/state_store.rs b/crates/openhuman-core/src/memory/state_store.rsindex a123900de6..104d98f095 100644--- a/crates/openhuman-core/src/memory/state_store.rs+++ b/crates/openhuman-core/src/memory/state_store.rs@@ -94,11 +94,12 @@ fn open_strict(workspace_dir: &Path, name: &str) -> Result<StateKv> {Ok(kv)}-/// Imports every `<workspace>/memory/*.json` state file into the `local` scope-/// of an explicit `scoped` handle, once each. For the layout migration-/// (`storage::layout`), which deletes those files afterwards; a file that is-/// not JSON is an error here (nothing may be deleted unimported), so it is-/// imported strictly. Returns the names imported.+/// Imports every `<workspace>/memory/*.json` state file once into the local+/// scope, except the pending-deletion queue, which is imported into its+/// workspace-owned module scope. For the layout migration (`storage::layout`),+/// which deletes those files afterwards; a file that is not JSON is an error+/// here (nothing may be deleted unimported), so it is imported strictly.+/// Returns the names imported.////// # Errors///@@ -142,20 +143,29 @@ pub(crate) fn import_all(if let Some(previous) =local_kv.get::<Vec<super::deletion::PendingDeletion>>("pending_deletions")?{- let mut pending = queue_kv- .get::<Vec<super::deletion::PendingDeletion>>("pending_deletions")?- .unwrap_or_default();- for deletion in previous {- if !pending.contains(&deletion) {- pending.push(deletion);- }- }- if pending.is_empty() {- queue_kv.delete("pending_deletions")?;- } else {- queue_kv.put("pending_deletions", &pending)?;- }- local_kv.delete("pending_deletions")?;+ let transferred = previous.clone();+ queue_kv.update::<Vec<super::deletion::PendingDeletion>, _>(+ "pending_deletions",+ move |pending| {+ let mut changed = false;+ for deletion in &previous {+ if !pending.contains(deletion) {+ pending.push(deletion.clone());+ changed = true;+ }+ }+ ((), changed)+ },+ )?;+ local_kv.update::<Vec<super::deletion::PendingDeletion>, _>(+ "pending_deletions",+ move |pending| {+ let before = pending.len();+ pending.retain(|deletion| !transferred.contains(deletion));+ let changed = before != pending.len();+ ((), changed)+ },+ )?;}names.sort();Ok(names)diff --git a/crates/openhuman-core/src/memory/state_store_tests.rs b/crates/openhuman-core/src/memory/state_store_tests.rsindex a2fd2d7b33..7103d482fe 100644--- a/crates/openhuman-core/src/memory/state_store_tests.rs+++ b/crates/openhuman-core/src/memory/state_store_tests.rs@@ -123,7 +123,8 @@ fn layout_import_places_legacy_retry_queue_in_its_workspace_scope() {local_queue.get::<Vec<crate::memory::deletion::PendingDeletion>>("pending_deletions").unwrap()- .is_none(),+ .unwrap_or_default()+ .is_empty(),"the migration must not strand a duplicate queue in local scope");}