Skip to content

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

chore: files changed crates/openhuman-core/src/memory/deletion.rs,crates/openhuman-core/src/memory/s

Steven Enamakelb3a1925a9aea
diff --git a/crates/openhuman-core/src/memory/deletion.rs b/crates/openhuman-core/src/memory/deletion.rs
index 30aeda8647..36a98f9519 100644
--- a/crates/openhuman-core/src/memory/deletion.rs
+++ b/crates/openhuman-core/src/memory/deletion.rs
@@ -56,7 +56,7 @@ impl ListStore<PendingDeletion> for FileStore {
&self.workspace_dir,
STATE,
)
- .map_err(|error| StoreError(error.to_string()));
+ .map_err(|error| StoreError(error.to_string()));
}
let all = all.to_vec();
super::state_store::save_workspace(&self.workspace_dir, STATE, &all)
diff --git a/crates/openhuman-core/src/memory/state_store.rs b/crates/openhuman-core/src/memory/state_store.rs
index 93214f3541..7f0f306416 100644
--- a/crates/openhuman-core/src/memory/state_store.rs
+++ b/crates/openhuman-core/src/memory/state_store.rs
@@ -136,15 +136,17 @@ fn legacy_queue_scopes(workspace_dir: &Path) -> Vec<crate::storage::Scope> {
.is_some_and(|(active, requested)| active == requested);
if active_matches {
if let Ok(tenant) = dispatch.tenant() {
- match (tenant.profile, tenant.agent) {
- (Some(profile), _) if known_profile.as_ref().is_none_or(|known| known == &profile) => {
- scopes.push(crate::storage::scope_for_profile(&profile));
- }
- (None, Some(agent)) if known_profile.is_none() => {
- scopes.push(crate::storage::scope_for_agent(&agent));
+ match (tenant.profile, tenant.agent) {
+ (Some(profile), _)
+ if known_profile.as_ref().is_none_or(|known| known == &profile) =>
+ {
+ scopes.push(crate::storage::scope_for_profile(&profile));
+ }
+ (None, Some(agent)) if known_profile.is_none() => {
+ scopes.push(crate::storage::scope_for_agent(&agent));
+ }
+ _ => {}
}
- _ => {}
- }
}
}
diff --git a/crates/openhuman-core/src/memory/state_store_tests.rs b/crates/openhuman-core/src/memory/state_store_tests.rs
index 9816bd935d..cf9a37bcca 100644
--- a/crates/openhuman-core/src/memory/state_store_tests.rs
+++ b/crates/openhuman-core/src/memory/state_store_tests.rs
@@ -131,17 +131,17 @@ fn first_workspace_open_transfers_only_its_old_profile_queue_and_rechecks_after_
let bob_item = PendingDeletion::Thread {
thread_id: "bob-owed".into(),
};
- alice_old.put("pending_deletions", &vec![alice_item.clone()]).unwrap();
- bob_old.put("pending_deletions", &vec![bob_item.clone()]).unwrap();
+ alice_old
+ .put("pending_deletions", &vec![alice_item.clone()])
+ .unwrap();
+ bob_old
+ .put("pending_deletions", &vec![bob_item.clone()])
+ .unwrap();
let alice_scope = super::workspace_scope(&alice_workspace).unwrap();
- let alice_target = crate::storage::state_kv::StateKv::on_backend(
- &backend,
- &alice_scope,
- "memory",
- "state",
- )
- .unwrap();
+ let alice_target =
+ crate::storage::state_kv::StateKv::on_backend(&backend, &alice_scope, "memory", "state")
+ .unwrap();
super::migrate_existing_queue_scopes(&alice_workspace, &backend, &alice_scope, &alice_target)
.unwrap();
assert_eq!(
@@ -186,14 +186,11 @@ fn first_workspace_open_transfers_only_its_old_profile_queue_and_rechecks_after_
);
let bob_scope = super::workspace_scope(&bob_workspace).unwrap();
- let bob_target = crate::storage::state_kv::StateKv::on_backend(
- &backend,
- &bob_scope,
- "memory",
- "state",
- )
- .unwrap();
- super::migrate_existing_queue_scopes(&bob_workspace, &backend, &bob_scope, &bob_target).unwrap();
+ let bob_target =
+ crate::storage::state_kv::StateKv::on_backend(&backend, &bob_scope, "memory", "state")
+ .unwrap();
+ super::migrate_existing_queue_scopes(&bob_workspace, &backend, &bob_scope, &bob_target)
+ .unwrap();
assert_eq!(
bob_target
.get::<Vec<PendingDeletion>>("pending_deletions")
@@ -217,25 +214,17 @@ async fn a_matching_active_agent_scope_is_a_legacy_source() {
let backend: std::sync::Arc<dyn crate::storage::StorageBackend> =
std::sync::Arc::new(crate::storage::MemoryStorage::new());
let old_scope = crate::storage::scope_for_agent("agent-a");
- let old = crate::storage::state_kv::StateKv::on_backend(
- &backend,
- &old_scope,
- "memory",
- "state",
- )
- .unwrap();
+ let old =
+ crate::storage::state_kv::StateKv::on_backend(&backend, &old_scope, "memory", "state")
+ .unwrap();
let item = crate::memory::deletion::PendingDeletion::Thread {
thread_id: "agent-owed".into(),
};
old.put("pending_deletions", &vec![item.clone()]).unwrap();
let target_scope = super::workspace_scope(&workspace).unwrap();
- let target = crate::storage::state_kv::StateKv::on_backend(
- &backend,
- &target_scope,
- "memory",
- "state",
- )
- .unwrap();
+ let target =
+ crate::storage::state_kv::StateKv::on_backend(&backend, &target_scope, "memory", "state")
+ .unwrap();
let migrated = CoreContext::scope(context.clone(), async {
super::legacy_queue_scopes(&workspace).contains(&old_scope)
@@ -253,13 +242,9 @@ async fn a_matching_active_agent_scope_is_a_legacy_source() {
let other_workspace = tmp.path().join("other-workspace");
let other_scope = super::workspace_scope(&other_workspace).unwrap();
- let other_target = crate::storage::state_kv::StateKv::on_backend(
- &backend,
- &other_scope,
- "memory",
- "state",
- )
- .unwrap();
+ let other_target =
+ crate::storage::state_kv::StateKv::on_backend(&backend, &other_scope, "memory", "state")
+ .unwrap();
CoreContext::scope(context, async {
super::migrate_existing_queue_scopes(
&other_workspace,