Skip to content

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

fix(memory): bridge the four defaulted module members instead of refusing

M3gA-Mind4404c8fa7dfa
diff --git a/src/openhuman/modules/memory.rs b/src/openhuman/modules/memory.rs
index e91bbfbfe5..887e81c74b 100644
--- a/src/openhuman/modules/memory.rs
+++ b/src/openhuman/modules/memory.rs
@@ -167,13 +167,14 @@ use tinymemory_api::provider::types::{
};
use tinymemory_api::provider::{
AddressBookSeedOutcome, ChunkDetail, ChunkEmbedding, ChunkListRow, ChunkQuery,
- ConversationSegment, CoverWindowQuery, EntityMatch, EpisodicEvent, EpisodicTurn, FacetType,
- FastRetrieveQuery, MemoryChunks, MemoryCodingSessions, MemoryCore, MemoryDiff, MemoryDocuments,
- MemoryEntities, MemoryEpisodic, MemoryGoals, MemoryGraph, MemoryIngest, MemoryMaintenance,
- MemoryPeople, MemoryPortability, MemoryProfile, MemoryProvider, MemoryRecall, MemoryRetrieval,
- MemorySourceSink, MemorySourceSync, MemoryToolMemory, MemoryTree, PersonHandle,
- PersonInteraction, PersonRecord, PersonScore, ProfileFacet, RankedPerson, ResolvedPerson,
- RetrievalHit, RetrievalResponse, SourceRetrievalQuery, SourceTotal, UserState,
+ ConversationSegment, CoverWindowQuery, Diagnosis, EntityMatch, EpisodicEvent, EpisodicTurn,
+ FacetType, FastRetrieveQuery, MemoryChunks, MemoryCodingSessions, MemoryCore, MemoryDiff,
+ MemoryDocuments, MemoryEntities, MemoryEpisodic, MemoryGoals, MemoryGraph, MemoryIngest,
+ MemoryMaintenance, MemoryPeople, MemoryPortability, MemoryProfile, MemoryProvider,
+ MemoryRecall, MemoryRetrieval, MemorySourceSink, MemorySourceSync, MemoryToolMemory,
+ MemoryTree, PersonHandle, PersonInteraction, PersonRecord, PersonScore, ProfileFacet,
+ RankedPerson, ResolvedPerson, RetrievalHit, RetrievalResponse, SourceRetrievalQuery,
+ SourceTotal, UserState,
};
use tinymemory_api::recall::OwnedRecallOpts;
use tinymemory_api::tool_memory::ToolMemoryRule;
@@ -1079,6 +1080,9 @@ impl MemoryMaintenance for ModuleMemoryProvider {
async fn purge_all(&self) -> Result<PurgeOutcome, MemoryError> {
module_call!(self, "purge_all", "PurgeAll", ())
}
+ async fn diagnose(&self) -> Result<Diagnosis, MemoryError> {
+ module_call!(self, "diagnose", "Diagnose", ())
+ }
}
#[async_trait]
@@ -1095,6 +1099,24 @@ impl MemorySourceSync for ModuleMemoryProvider {
(toolkit, connection_id)
)
}
+ async fn run_source_sync(&self, source_id: &str) -> Result<SyncRunOutcome, MemoryError> {
+ module_call!(self, "run_source_sync", "RunSourceSync", (source_id,))
+ }
+ async fn bootstrap_connection(
+ &self,
+ toolkit: &str,
+ connection_id: &str,
+ ) -> Result<(), MemoryError> {
+ module_call!(
+ self,
+ "bootstrap_connection",
+ "BootstrapConnection",
+ (toolkit, connection_id)
+ )
+ }
+ async fn is_toolkit_syncable(&self, toolkit: &str) -> Result<bool, MemoryError> {
+ module_call!(self, "is_toolkit_syncable", "IsToolkitSyncable", (toolkit,))
+ }
async fn source_sync_state(
&self,
toolkit: &str,
diff --git a/src/openhuman/modules/memory_tests.rs b/src/openhuman/modules/memory_tests.rs
index 0713121eeb..0b6863bae4 100644
--- a/src/openhuman/modules/memory_tests.rs
+++ b/src/openhuman/modules/memory_tests.rs
@@ -414,3 +414,65 @@ fn the_ingest_bus_grace_is_wide_enough_to_order_the_two_timers() {
reliably order the RPC's timeout ahead of the bus deadline"
);
}
+
+/// Every `MemorySourceSync` and `MemoryMaintenance` member the trait defaults
+/// must be bridged to the module rather than left to inherit the default.
+///
+/// Three of these members carry a default body that returns
+/// `Unsupported(SourceSync)`, and `diagnose` one that returns
+/// `Unsupported(Maintenance)`. A defaulted member cannot break an implementor at
+/// compile time, so when they were added to the contract `ModuleMemoryProvider`
+/// kept compiling and silently began refusing — which is #5801: the manual
+/// "Sync now" button answered `unsupported capability: source_sync` while the
+/// module's own scheduler, which never crosses this bridge, kept syncing fine.
+///
+/// The discriminator needs no module. With the host disabled, `proxy()` fails
+/// with `MemoryError::Other`, so a member that really dispatches through
+/// `module_call!` reports `Other` while one that fell through to the default
+/// reports `Unsupported`. Asserting "not Unsupported" therefore asserts the
+/// dispatch itself, which is the part that was missing.
+#[tokio::test]
+async fn the_defaulted_members_dispatch_to_the_module_instead_of_refusing() {
+ use tinymemory_api::provider::{MemoryMaintenance, MemorySourceSync};
+
+ let mut config = Config::default();
+ config.modules.enabled = false;
+ let provider = ModuleMemoryProvider::new(Arc::new(config));
+
+ let refused = |label: &str, error: MemoryError| {
+ assert!(
+ !matches!(error, MemoryError::Unsupported { .. }),
+ "{label} answered from the trait default instead of dispatching to the \
+ module — the `module_call!` arm is missing, so every caller gets \
+ `unsupported capability` however capable the artifact is. Got {error:?}"
+ );
+ };
+
+ refused(
+ "run_source_sync",
+ provider
+ .run_source_sync("src_whatever")
+ .await
+ .expect_err("a disabled host cannot succeed"),
+ );
+ refused(
+ "bootstrap_connection",
+ provider
+ .bootstrap_connection("gmail", "ca_whatever")
+ .await
+ .expect_err("a disabled host cannot succeed"),
+ );
+ refused(
+ "is_toolkit_syncable",
+ provider
+ .is_toolkit_syncable("gmail")
+ .await
+ .expect_err("a disabled host cannot succeed"),
+ );
+ refused(
+ "diagnose",
+ MemoryMaintenance::diagnose(&provider)
+ .await
+ .expect_err("a disabled host cannot succeed"),
+ );
+}