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/core/runtime/services.rs,crates/openhuman-core/src/co

Steven Enamakel8a4b378ee446
diff --git a/crates/openhuman-core/src/core/runtime/services.rs b/crates/openhuman-core/src/core/runtime/services.rs
index 4deaf6f113..43d3d2965f 100644
--- a/crates/openhuman-core/src/core/runtime/services.rs
+++ b/crates/openhuman-core/src/core/runtime/services.rs
@@ -508,8 +508,8 @@ pub fn spawn_socket_auto_connect(
Ok(Some(t)) => t,
Ok(None) => {
log::info!(
- "[socket] No session token stored — skipping auto-connect (will connect after login)"
- );
+ "[socket] No session token stored — skipping auto-connect (will connect after login)"
+ );
return;
}
Err(e) => {
diff --git a/crates/openhuman-core/src/core/runtime/services_tests.rs b/crates/openhuman-core/src/core/runtime/services_tests.rs
index 1a02d9751e..ac4402210f 100644
--- a/crates/openhuman-core/src/core/runtime/services_tests.rs
+++ b/crates/openhuman-core/src/core/runtime/services_tests.rs
@@ -96,10 +96,12 @@ async fn stopping_service_tasks_aborts_every_tracked_task() {
tasks.stop();
assert_eq!(tasks.len(), 0);
// The sender drops when the aborted task is torn down.
- assert!(tokio::time::timeout(std::time::Duration::from_secs(5), rx)
- .await
- .expect("the aborted task is torn down")
- .is_err());
+ assert!(
+ tokio::time::timeout(std::time::Duration::from_secs(5), rx)
+ .await
+ .expect("the aborted task is torn down")
+ .is_err()
+ );
}
#[tokio::test]
@@ -115,10 +117,12 @@ async fn dropping_service_tasks_aborts_them() {
}),
);
}
- assert!(tokio::time::timeout(std::time::Duration::from_secs(5), rx)
- .await
- .expect("the aborted task is torn down")
- .is_err());
+ assert!(
+ tokio::time::timeout(std::time::Duration::from_secs(5), rx)
+ .await
+ .expect("the aborted task is torn down")
+ .is_err()
+ );
}
#[test]
diff --git a/crates/openhuman-core/src/memory/brain.rs b/crates/openhuman-core/src/memory/brain.rs
index a92b019ecf..f9b0367d49 100644
--- a/crates/openhuman-core/src/memory/brain.rs
+++ b/crates/openhuman-core/src/memory/brain.rs
@@ -16,8 +16,8 @@ use tinymemory_integrations::documents::RawDocument;
use tinymemory_tools::layout::placement::{brain_node_with, files_source};
use tinymemory_tools::{Brain, BrainSource, MemoryLayout};
-use crate::config::schema::MemorySourceKind;
use crate::config::Config;
+use crate::config::schema::MemorySourceKind;
use super::engine;
use super::lifecycle::jobs;
@@ -186,14 +186,16 @@ pub async fn ingest(
let size = std::fs::metadata(path)
.map_err(|error| Error::InvalidRequest(format!("cannot read the file: {error}")))?
.len();
- tinymemory_integrations::brain::check_ingest_size(size).map_err(|error| match error {
- tinymemory_integrations::documents::Error::TooLarge { .. } => {
- Error::InvalidRequest(format!(
- "the file is {size} bytes; the limit is {MAX_INGEST_BYTES}"
- ))
- }
- error => Error::InvalidRequest(error.to_string()),
- })?;
+ tinymemory_integrations::brain::check_ingest_size(size).map_err(
+ |error| match error {
+ tinymemory_integrations::documents::Error::TooLarge { .. } => {
+ Error::InvalidRequest(format!(
+ "the file is {size} bytes; the limit is {MAX_INGEST_BYTES}"
+ ))
+ }
+ error => Error::InvalidRequest(error.to_string()),
+ },
+ )?;
let bytes = tokio::fs::read(path)
.await
.map_err(|error| Error::InvalidRequest(format!("cannot read the file: {error}")))?;
@@ -218,7 +220,7 @@ pub async fn ingest(
_ => {
return Err(Error::InvalidRequest(
("pass exactly one of `path` or `text`").into(),
- ))
+ ));
}
};
if let Some(title) = params.title.filter(|title| !title.trim().is_empty()) {
diff --git a/crates/openhuman-core/src/memory/brain_tests.rs b/crates/openhuman-core/src/memory/brain_tests.rs
index ddfea31b1b..3ee4fb5062 100644
--- a/crates/openhuman-core/src/memory/brain_tests.rs
+++ b/crates/openhuman-core/src/memory/brain_tests.rs
@@ -206,17 +206,19 @@ async fn ingest_refuses_bad_input() {
Err(Error::InvalidRequest(_))
));
}
- assert!(search(
- &config,
- &tinymemory_tools::layout::identity::Identity::root(),
- BrainSearchParams {
- query: " ".into(),
- source: None,
- limit: None
- }
- )
- .await
- .is_err());
+ assert!(
+ search(
+ &config,
+ &tinymemory_tools::layout::identity::Identity::root(),
+ BrainSearchParams {
+ query: " ".into(),
+ source: None,
+ limit: None
+ }
+ )
+ .await
+ .is_err()
+ );
}
#[tokio::test]
@@ -250,10 +252,7 @@ async fn ingest_keeps_the_legacy_oversized_file_error() {
bind_reference(&config);
let path = tmp.path().join("oversized.bin");
let size = MAX_INGEST_BYTES + 1;
- std::fs::File::create(&path)
- .unwrap()
- .set_len(size)
- .unwrap();
+ std::fs::File::create(&path).unwrap().set_len(size).unwrap();
let error = ingest(
&config,
@@ -296,8 +295,8 @@ async fn a_file_is_converted_and_filed_under_files() {
#[tokio::test]
async fn an_ingest_queues_a_belief_build_only_for_an_engine_that_waits_for_one() {
use std::sync::Arc;
- use tinymemory_api::conformance::ReferenceEngine;
use tinymemory_api::Consolidation;
+ use tinymemory_api::conformance::ReferenceEngine;
for (consolidation, queued) in [(Consolidation::OnDemand, 1), (Consolidation::Automatic, 0)] {
let tmp = tempfile::tempdir().unwrap();
diff --git a/crates/openhuman-core/src/memory/sources/mod.rs b/crates/openhuman-core/src/memory/sources/mod.rs
index 34b1675bd0..817c83ac0b 100644
--- a/crates/openhuman-core/src/memory/sources/mod.rs
+++ b/crates/openhuman-core/src/memory/sources/mod.rs
@@ -13,8 +13,8 @@ mod sync;
use tinymemory_integrations::sources::{Error as SourceError, SourceSpec};
use tinymemory_tools::ops::MemoryOps;
-use crate::config::schema::{MemorySourceConfig, MemorySourceKind};
use crate::config::Config;
+use crate::config::schema::{MemorySourceConfig, MemorySourceKind};
use super::engine;
use super::types::{SourceView, SourcesAddParams};
diff --git a/crates/openhuman-core/src/memory/sources/sync.rs b/crates/openhuman-core/src/memory/sources/sync.rs
index 85f609bc8d..b3d05d1cd0 100644
--- a/crates/openhuman-core/src/memory/sources/sync.rs
+++ b/crates/openhuman-core/src/memory/sources/sync.rs
@@ -11,14 +11,14 @@ use std::path::PathBuf;
use std::sync::{Arc, LazyLock, Mutex, PoisonError};
use chrono::{DateTime, Utc};
+use tinymemory_integrations::sources::SourceKind;
use tinymemory_integrations::sources::sync::{
self as module, RegisteredSource, SourceRegistry, SyncError, SyncState, SyncStatus, SyncUpdate,
Syncer,
};
-use tinymemory_integrations::sources::SourceKind;
-use crate::config::schema::{MemorySourceConfig, MemorySourceKind};
use crate::config::Config;
+use crate::config::schema::{MemorySourceConfig, MemorySourceKind};
use crate::memory::engine;
use crate::memory::types::SourceStatus;
use tinymemory_api::{Error, Result};
diff --git a/crates/openhuman-core/src/memory/sources/sync_tests.rs b/crates/openhuman-core/src/memory/sources/sync_tests.rs
index eb7b589ac0..24d8b46b46 100644
--- a/crates/openhuman-core/src/memory/sources/sync_tests.rs
+++ b/crates/openhuman-core/src/memory/sources/sync_tests.rs
@@ -101,9 +101,11 @@ async fn sync_one_reports_memory_off_and_unreadable_sources() {
bind_reference(&config);
let missing = config.action_dir.join("does-not-exist");
- assert!(sync_one(&config, &folder_source("s", &missing, None))
- .await
- .is_err());
+ assert!(
+ sync_one(&config, &folder_source("s", &missing, None))
+ .await
+ .is_err()
+ );
}
#[tokio::test]
@@ -196,13 +198,15 @@ async fn a_source_already_syncing_is_not_started_twice() {
// Hold a claim as a running sync would: a second request starts nothing.
let held = syncer_for(&config).start(Some("src-once")).unwrap();
assert_eq!(held.len(), 1);
- assert!(start_sync(
- &crate::core::runtime::DispatchCtx::ambient(),
- &config,
- Some("src-once")
- )
- .unwrap()
- .is_empty());
+ assert!(
+ start_sync(
+ &crate::core::runtime::DispatchCtx::ambient(),
+ &config,
+ Some("src-once")
+ )
+ .unwrap()
+ .is_empty()
+ );
drop(held);
assert_eq!(
start_sync(
@@ -265,12 +269,14 @@ fn sync_due_with_memory_off_starts_nothing() {
.memory
.sources
.push(folder_source("s", tmp.path(), Some(15)));
- assert!(sync_due(
- &crate::core::runtime::DispatchCtx::ambient(),
- &config,
- Utc::now()
- )
- .is_empty());
+ assert!(
+ sync_due(
+ &crate::core::runtime::DispatchCtx::ambient(),
+ &config,
+ Utc::now()
+ )
+ .is_empty()
+ );
}
#[test]
@@ -295,8 +301,8 @@ fn reset_interrupted_marks_syncing_sources_idle() {
#[tokio::test]
async fn a_sync_queues_a_belief_build_only_for_an_engine_that_waits_for_one() {
use std::sync::Arc;
- use tinymemory_api::conformance::ReferenceEngine;
use tinymemory_api::Consolidation;
+ use tinymemory_api::conformance::ReferenceEngine;
let note = || {
tinymemory_api::StoreItem::document(