Skip to content

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

style(memory): apply rustfmt formatting to memory module

Steven Enamakel5484763708a3
diff --git a/crates/openhuman-core/src/memory/backfill.rs b/crates/openhuman-core/src/memory/backfill.rs
index a6f698fce5..75db5de6b0 100644
--- a/crates/openhuman-core/src/memory/backfill.rs
+++ b/crates/openhuman-core/src/memory/backfill.rs
@@ -40,8 +40,8 @@ use crate::config::Config;
use crate::memory::engine::{self, BoundEngine};
use crate::memory::error::{MemoryError, MemoryResult};
use crate::memory::scope::{MemoryIdentity, ResolvedIdentity};
-use tinymemory_integrations::import::ImportPhase;
use crate::threads::store::blocking as threads;
+use tinymemory_integrations::import::ImportPhase;
use tinymemory_tools::backfill::{first_live_turn, group_items, turn_groups, ThreadMessage};
pub use tinymemory_tools::backfill::{pending_range, turns_of, PastTurn, BACKFILL_TAG, MAIN_AGENT};
diff --git a/crates/openhuman-core/src/memory/import.rs b/crates/openhuman-core/src/memory/import.rs
index 413ade8ea8..24ebe6e472 100644
--- a/crates/openhuman-core/src/memory/import.rs
+++ b/crates/openhuman-core/src/memory/import.rs
@@ -136,8 +136,8 @@ pub async fn scan(config: &Config) -> MemoryResult<ImportScanView> {
let counts = tokio::task::spawn_blocking(move || {
tinymemory_integrations::import::count_legacy(&workspace_dir)
})
- .await
- .map_err(|error| MemoryError::Engine(format!("import scan failed: {error}")))?;
+ .await
+ .map_err(|error| MemoryError::Engine(format!("import scan failed: {error}")))?;
let counts = counts.map(|counts: LegacyImportCounts| ImportCounts {
documents: counts.documents,
conversations: counts.conversations,
diff --git a/crates/openhuman-core/src/memory/lifecycle/hooks.rs b/crates/openhuman-core/src/memory/lifecycle/hooks.rs
index 2fab90f56f..7cf8964fbf 100644
--- a/crates/openhuman-core/src/memory/lifecycle/hooks.rs
+++ b/crates/openhuman-core/src/memory/lifecycle/hooks.rs
@@ -279,13 +279,13 @@ pub(crate) async fn pre_turn_work(
.find_map(Result::ok)
.and_then(TurnPack::from_pack)
.or_else(|| {
- let error = refusal?;
- tracing::warn!(
- code = error.code(),
- %error,
- "[memory:hooks] recall refused; the turn is told memory is unavailable"
- );
- TurnPack::refused(&error, engine_id)
+ let error = refusal?;
+ tracing::warn!(
+ code = error.code(),
+ %error,
+ "[memory:hooks] recall refused; the turn is told memory is unavailable"
+ );
+ TurnPack::refused(&error, engine_id)
})
}
.await;
diff --git a/crates/openhuman-core/src/memory/lifecycle/hooks_tests.rs b/crates/openhuman-core/src/memory/lifecycle/hooks_tests.rs
index 3bbe6fc059..f9ece7204e 100644
--- a/crates/openhuman-core/src/memory/lifecycle/hooks_tests.rs
+++ b/crates/openhuman-core/src/memory/lifecycle/hooks_tests.rs
@@ -7,16 +7,38 @@ use tinymemory_api::{
use crate::memory::scope::MemoryIdentity;
use crate::memory::test_fixtures::{bind_reference, config_in, stored};
-type PreTurnArgs = (String, u32, String, u32, DateTime<Utc>, bool, Option<tinymemory_api::ObservedActor>);
+type PreTurnArgs = (
+ String,
+ u32,
+ String,
+ u32,
+ DateTime<Utc>,
+ bool,
+ Option<tinymemory_api::ObservedActor>,
+);
type PostTurnArgs = (String, u32, String, Vec<ToolCallSummary>, DateTime<Utc>);
fn input(thread: &str, index: u32, text: &str) -> PreTurnArgs {
- (thread.to_string(), index, text.to_string(), 0, Utc::now(), false, None)
+ (
+ thread.to_string(),
+ index,
+ text.to_string(),
+ 0,
+ Utc::now(),
+ false,
+ None,
+ )
}
fn reply(thread: &str, index: u32, text: &str) -> PostTurnArgs {
- (thread.to_string(), index, text.to_string(), Vec::new(), Utc::now())
+ (
+ thread.to_string(),
+ index,
+ text.to_string(),
+ Vec::new(),
+ Utc::now(),
+ )
}
async fn run_pre_turn(
@@ -25,7 +47,19 @@ async fn run_pre_turn(
identity: &crate::memory::scope::ResolvedIdentity,
(thread, index, text, in_prompt_from, at, resumed, observed_actor): PreTurnArgs,
) -> Option<TurnPack> {
- pre_turn_work(ctx, config, identity, thread, index, text, in_prompt_from, at, resumed, observed_actor).await
+ pre_turn_work(
+ ctx,
+ config,
+ identity,
+ thread,
+ index,
+ text,
+ in_prompt_from,
+ at,
+ resumed,
+ observed_actor,
+ )
+ .await
}
async fn run_post_turn(
diff --git a/crates/openhuman-core/src/memory/lifecycle/prefetch_tests.rs b/crates/openhuman-core/src/memory/lifecycle/prefetch_tests.rs
index cbd5d69e6f..e64c2c467d 100644
--- a/crates/openhuman-core/src/memory/lifecycle/prefetch_tests.rs
+++ b/crates/openhuman-core/src/memory/lifecycle/prefetch_tests.rs
@@ -327,16 +327,28 @@ async fn slow_engine_results_survive_the_manual_pre_turn_cutoff() {
.unwrap();
crate::memory::engine::install_test_engine(&config.workspace_dir, engine.clone());
let identity = MemoryIdentity::agent("a").resolve(&config);
- let input = |index| (
- "slow".to_string(),
- index,
- "what is my favourite colour?".to_string(),
- 0,
- chrono::Utc::now(),
- false,
- None,
- );
- let pre_turn = |config, identity, input: (String, u32, String, u32, chrono::DateTime<chrono::Utc>, bool, Option<tinymemory_api::ObservedActor>)| {
+ let input = |index| {
+ (
+ "slow".to_string(),
+ index,
+ "what is my favourite colour?".to_string(),
+ 0,
+ chrono::Utc::now(),
+ false,
+ None,
+ )
+ };
+ let pre_turn = |config,
+ identity,
+ input: (
+ String,
+ u32,
+ String,
+ u32,
+ chrono::DateTime<chrono::Utc>,
+ bool,
+ Option<tinymemory_api::ObservedActor>,
+ )| {
let (thread, index, text, in_prompt_from, at, resumed, observed_actor) = input;
super::pre_turn(
&crate::core::runtime::DispatchCtx::ambient(),
diff --git a/crates/openhuman-core/src/memory/mod.rs b/crates/openhuman-core/src/memory/mod.rs
index cf665108ec..b029b534f8 100644
--- a/crates/openhuman-core/src/memory/mod.rs
+++ b/crates/openhuman-core/src/memory/mod.rs
@@ -58,5 +58,3 @@ pub use schemas::{
all_registered_controllers as all_memory_registered_controllers,
};
pub use tools::{MemoryTool, MEMORY_TOOL_NAME};
-
-/// Host-specific connector prefix configuration for memory provenance.
diff --git a/crates/openhuman-core/src/memory/schemas_tests.rs b/crates/openhuman-core/src/memory/schemas_tests.rs
index 90e1031806..9eedb14abe 100644
--- a/crates/openhuman-core/src/memory/schemas_tests.rs
+++ b/crates/openhuman-core/src/memory/schemas_tests.rs
@@ -450,23 +450,34 @@ async fn rpc_learn_invalidates_a_cached_prefetch_pack() {
let dispatch = DispatchCtx::new(ctx.clone());
let identity = crate::memory::scope::MemoryIdentity::root().resolve(&config);
let thread = "rpc-learn-invalidates-prefetch";
- let input = || (
- thread.to_string(),
- 0,
- "What coffee do I like?".to_string(),
- 0,
- chrono::Utc::now(),
- false,
- None,
- );
+ let input = || {
+ (
+ thread.to_string(),
+ 0,
+ "What coffee do I like?".to_string(),
+ 0,
+ chrono::Utc::now(),
+ false,
+ None,
+ )
+ };
CoreContext::scope(ctx.clone(), async {
let config = Arc::new(config.clone());
let (thread_id, turn_index, user_text, in_prompt_from, at, resumed, observed_actor) =
input();
assert!(crate::memory::lifecycle::prefetch::pre_turn(
- &dispatch, config.clone(), identity.clone(), thread_id, turn_index, user_text,
- in_prompt_from, at, resumed, observed_actor, None,
+ &dispatch,
+ config.clone(),
+ identity.clone(),
+ thread_id,
+ turn_index,
+ user_text,
+ in_prompt_from,
+ at,
+ resumed,
+ observed_actor,
+ None,
)
.is_none());
crate::memory::lifecycle::prefetch::settle_for_test(
@@ -477,8 +488,17 @@ async fn rpc_learn_invalidates_a_cached_prefetch_pack() {
input();
assert!(
crate::memory::lifecycle::prefetch::pre_turn(
- &dispatch, config.clone(), identity.clone(), thread_id, turn_index, user_text,
- in_prompt_from, at, resumed, observed_actor, None,
+ &dispatch,
+ config.clone(),
+ identity.clone(),
+ thread_id,
+ turn_index,
+ user_text,
+ in_prompt_from,
+ at,
+ resumed,
+ observed_actor,
+ None,
)
.is_some(),
"the initial turn should consume its completed pack"
@@ -496,8 +516,17 @@ async fn rpc_learn_invalidates_a_cached_prefetch_pack() {
input();
assert!(
crate::memory::lifecycle::prefetch::pre_turn(
- &dispatch, config, identity, thread_id, turn_index, user_text, in_prompt_from,
- at, resumed, observed_actor, None,
+ &dispatch,
+ config,
+ identity,
+ thread_id,
+ turn_index,
+ user_text,
+ in_prompt_from,
+ at,
+ resumed,
+ observed_actor,
+ None,
)
.is_none(),
"a later turn must not consume a pack cached before RPC learn"