Skip to content

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

refactor(memory): qualify Result paths to avoid shadowing

Steven Enamakel4a08d90532a9
diff --git a/crates/openhuman-core/src/memory/deletion.rs b/crates/openhuman-core/src/memory/deletion.rs
index e3d9aae66f..e1a2cf1431 100644
--- a/crates/openhuman-core/src/memory/deletion.rs
+++ b/crates/openhuman-core/src/memory/deletion.rs
@@ -54,7 +54,7 @@ impl ListStore<PendingDeletion> for FileStore {
}))
}
- fn save(&self, all: &[PendingDeletion]) -> Result<(), StoreError> {
+ fn save(&self, all: &[PendingDeletion]) -> std::result::Result<(), StoreError> {
if all.is_empty() {
return match std::fs::remove_file(&self.file) {
Ok(()) => Ok(()),
@@ -122,7 +122,7 @@ impl DeletionExecutor for Executor<'_> {
engine::resolve(self.config).is_on()
}
- async fn run(&self, deletion: &PendingDeletion) -> Result<usize, String> {
+ async fn run(&self, deletion: &PendingDeletion) -> std::result::Result<usize, String> {
let result = match deletion {
PendingDeletion::Thread { thread_id } => {
forget_thread_now(self.config, thread_id).await
diff --git a/crates/openhuman-core/src/memory/import.rs b/crates/openhuman-core/src/memory/import.rs
index a2c4bc697d..1b2c1e5949 100644
--- a/crates/openhuman-core/src/memory/import.rs
+++ b/crates/openhuman-core/src/memory/import.rs
@@ -77,7 +77,7 @@ impl CheckpointStore for FileCheckpointStore {
.unwrap_or_default()
}
- fn save(&self, file: &ImportFile) -> Result<(), String> {
+ fn save(&self, file: &ImportFile) -> std::result::Result<(), String> {
let json = serde_json::to_vec_pretty(file).map_err(|error| error.to_string())?;
write_atomic(&self.path, &json).map_err(|error| error.to_string())
}
diff --git a/crates/openhuman-core/src/memory/lifecycle/jobs.rs b/crates/openhuman-core/src/memory/lifecycle/jobs.rs
index 19c227125a..c525010719 100644
--- a/crates/openhuman-core/src/memory/lifecycle/jobs.rs
+++ b/crates/openhuman-core/src/memory/lifecycle/jobs.rs
@@ -63,7 +63,7 @@ impl QueueStore for FileQueueStore {
})
}
- fn save(&self, state: &QueueState) -> Result<(), String> {
+ fn save(&self, state: &QueueState) -> std::result::Result<(), String> {
serde_json::to_vec_pretty(state)
.map_err(|error| error.to_string())
.and_then(|json| {
diff --git a/crates/openhuman-core/src/memory/schemas/handlers.rs b/crates/openhuman-core/src/memory/schemas/handlers.rs
index 223f50f6b1..b5c5cc4bfb 100644
--- a/crates/openhuman-core/src/memory/schemas/handlers.rs
+++ b/crates/openhuman-core/src/memory/schemas/handlers.rs
@@ -58,7 +58,7 @@ where
})
}
-fn parse<T: DeserializeOwned>(params: Map<String, Value>) -> std::result::Result<T, String> {
+fn parse<T: DeserializeOwned>(params: Map<String, Value>) -> std::result::std::result::Result<T, String> {
serde_json::from_value(Value::Object(params))
.map_err(|error| {
StructuredRpcError::from(Error::InvalidRequest(format!("invalid params: {error}")))
diff --git a/crates/openhuman-core/src/memory/schemas_tests.rs b/crates/openhuman-core/src/memory/schemas_tests.rs
index 9eedb14abe..e6839633b7 100644
--- a/crates/openhuman-core/src/memory/schemas_tests.rs
+++ b/crates/openhuman-core/src/memory/schemas_tests.rs
@@ -54,7 +54,7 @@ fn object(value: Value) -> Map<String, Value> {
/// Runs `function`'s handler against `config` (as the embedder-supplied
/// config, so no on-disk config is read).
-async fn call(config: &Config, function: &str, params: Value) -> Result<Value, String> {
+async fn call(config: &Config, function: &str, params: Value) -> std::result::Result<Value, String> {
let handler = handler_for(function).expect("test function has a handler");
let ctx = CoreContext::for_test_with_config(DomainSet::full(), config.clone());
CoreContext::scope(ctx.clone(), async move {
diff --git a/crates/openhuman-core/src/memory/sources/sync.rs b/crates/openhuman-core/src/memory/sources/sync.rs
index 062fe61e7f..f29d9a8c7a 100644
--- a/crates/openhuman-core/src/memory/sources/sync.rs
+++ b/crates/openhuman-core/src/memory/sources/sync.rs
@@ -133,7 +133,7 @@ pub async fn sync_one(config: &Config, source: &MemorySourceConfig) -> Result<u6
run(config, source).await.map_err(host_error)
}
-async fn run(config: &Config, source: &MemorySourceConfig) -> Result<u64, SyncError> {
+async fn run(config: &Config, source: &MemorySourceConfig) -> std::result::Result<u64, SyncError> {
let bound = engine::resolve(config)
.engine()
.map_err(|error| SyncError::Invalid(error.to_string()))?;
@@ -163,7 +163,7 @@ pub(crate) async fn place_and_store(
items: Vec<tinymemory_api::StoreItem>,
(kind, source_id): (MemorySourceKind, &str),
layout: &tinymemory_tools::MemoryLayout,
-) -> Result<u64, SyncError> {
+) -> std::result::Result<u64, SyncError> {
let brain_source = crate::memory::brain::brain_source(kind);
// Placing an item under its brain node is pure, so every one is placed up
// front: the module stores `(node, item)` pairs and reports the nodes hit.
diff --git a/crates/openhuman-core/src/memory/tool_writes.rs b/crates/openhuman-core/src/memory/tool_writes.rs
index 03b1b072e8..bbdb8a73be 100644
--- a/crates/openhuman-core/src/memory/tool_writes.rs
+++ b/crates/openhuman-core/src/memory/tool_writes.rs
@@ -574,7 +574,7 @@ struct Executor<'a> {
#[async_trait]
impl WriteExecutor for Executor<'_> {
- async fn run(&self, operation: &WriteOperation) -> Result<(), String> {
+ async fn run(&self, operation: &WriteOperation) -> std::result::Result<(), String> {
let config = self.config;
let work = async {
match operation {
diff --git a/crates/openhuman-core/src/memory/tools.rs b/crates/openhuman-core/src/memory/tools.rs
index 9e77f45910..73aedac39a 100644
--- a/crates/openhuman-core/src/memory/tools.rs
+++ b/crates/openhuman-core/src/memory/tools.rs
@@ -162,7 +162,7 @@ fn arg_str(args: &Value, key: &str) -> Option<String> {
.map(str::to_string)
}
-fn parse<T: serde::de::DeserializeOwned>(args: &Value) -> Result<T, String> {
+fn parse<T: serde::de::DeserializeOwned>(args: &Value) -> std::result::Result<T, String> {
serde_json::from_value(args.clone()).map_err(|error| format!("invalid arguments: {error}"))
}
@@ -284,7 +284,7 @@ pub async fn run_action(
) -> ToolResult {
let action = arg_str(args, "action").unwrap_or_default();
tracing::debug!(action = %action, "[memory:tool] dispatch");
- let result: Result<Value, String> = match action.as_str() {
+ let result: std::result::Result<Value, String> = match action.as_str() {
// The agent answers from the evidence itself, so recall writes no
// answer of its own; and the thread the call runs in is left out of
// recall and fetch, since its user turn is logged before the tool