fix(mcp): propagate internal serialization errors instead of silently swallowing them to prevent LLM hallucination

This commit is contained in:
Riz Ashraf committed 2026-09-27 22:19:43 +01:00
1 parent f8925050db
commit 8f32a09399
13 files changed
+235 -63

No files matched your search

+10 -5
View File
@@ -244,14 +244,16 @@ impl MemoryIndex {
self.type_field => "entity",
self.namespace_field => e.namespace.as_str()
));
self.needs_commit.store(true, std::sync::atomic::Ordering::SeqCst);
self.needs_commit
.store(true, std::sync::atomic::Ordering::SeqCst);
}
}
pub fn delete_all(&self) {
if let Ok(writer) = self.writer.lock() {
let _ = writer.delete_all_documents();
self.needs_commit.store(true, std::sync::atomic::Ordering::SeqCst);
self.needs_commit
.store(true, std::sync::atomic::Ordering::SeqCst);
}
}
@@ -266,7 +268,8 @@ impl MemoryIndex {
self.namespace_field => "global"
));
println!("Writer add_document returned id/result");
self.needs_commit.store(true, std::sync::atomic::Ordering::SeqCst);
self.needs_commit
.store(true, std::sync::atomic::Ordering::SeqCst);
println!("Needs_commit set to true in add_task_sync");
} else {
println!("Failed to acquire writer lock in add_task_sync");
@@ -282,7 +285,8 @@ impl MemoryIndex {
self.type_field => "snippet",
self.namespace_field => "global"
));
self.needs_commit.store(true, std::sync::atomic::Ordering::SeqCst);
self.needs_commit
.store(true, std::sync::atomic::Ordering::SeqCst);
}
}
@@ -295,7 +299,8 @@ impl MemoryIndex {
self.type_field => "adr",
self.namespace_field => "global"
));
self.needs_commit.store(true, std::sync::atomic::Ordering::SeqCst);
self.needs_commit
.store(true, std::sync::atomic::Ordering::SeqCst);
}
}
}