Skip to content

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

refactor(memory): call error methods directly instead of converting

Steven Enamakel243716e81a93
diff --git a/crates/openhuman-core/src/memory/backfill.rs b/crates/openhuman-core/src/memory/backfill.rs
index d3800f09e1..ed297d10f5 100644
--- a/crates/openhuman-core/src/memory/backfill.rs
+++ b/crates/openhuman-core/src/memory/backfill.rs
@@ -303,14 +303,14 @@ async fn run(
.engine
.store_many_with(items, options)
.await
- .map_err(Error::from);
+ ;
if let Err(error) = stored {
tracing::warn!(
code = error.code(),
"[memory:backfill] storing a batch failed; stopping"
);
file.state.phase = ImportPhase::Error;
- file.state.error = Some(String::from(error));
+ file.state.error = Some(error.to_string());
file.state.finished_at = Some(Utc::now());
write_file(workspace_dir, &file);
return;
diff --git a/crates/openhuman-core/src/memory/guard.rs b/crates/openhuman-core/src/memory/guard.rs
index b1ce8c96c1..3c218ce019 100644
--- a/crates/openhuman-core/src/memory/guard.rs
+++ b/crates/openhuman-core/src/memory/guard.rs
@@ -68,7 +68,7 @@ impl ScrubbingEngine {
fn outcome<T>(result: &Result<T>) -> &'static str {
match result {
Ok(_) => "ok",
- Err(error) => Error::from(error.clone()).code(),
+ Err(error) => error.code(),
}
}
diff --git a/crates/openhuman-core/src/memory/import.rs b/crates/openhuman-core/src/memory/import.rs
index 23269e6fd9..a2c4bc697d 100644
--- a/crates/openhuman-core/src/memory/import.rs
+++ b/crates/openhuman-core/src/memory/import.rs
@@ -122,7 +122,7 @@ fn importer(
Arc::new(move || consent),
)
.with_describe(Arc::new(|error| {
- Error::from(error.clone()).to_string()
+ error.to_string()
}));
if let Some(paused) = paused {
importer = importer.with_pause(paused);
diff --git a/crates/openhuman-core/src/memory/ops.rs b/crates/openhuman-core/src/memory/ops.rs
index 3db341baeb..93e062374f 100644
--- a/crates/openhuman-core/src/memory/ops.rs
+++ b/crates/openhuman-core/src/memory/ops.rs
@@ -164,7 +164,7 @@ fn time_hint(config: &Config, refers_to: Option<RefersTo>) -> Result<Option<Time
};
TimeHint::new(from, to.unwrap_or(from), Some(config.time_zone()))
.map(Some)
- .map_err(Error::from)
+
}
/// `memory_recall`.