This ticket documents a series of fixes to improve the robustness of our ChromaDB query services within the Memory Core. The ChromaDB client throws an error when a where clause is constructed with an undefined value (e.g., where: { category: undefined }).
To address this, the following changes were made:
SummaryService.mjs (querySummaries):
- Refactored to conditionally build the
query object. The where clause is now only added if a category is provided.
MemoryService.mjs (queryMemories):
- Applied the same conditional query construction pattern. The
where clause is only added if a sessionId is provided.
MemoryService.mjs (listMemories):
- Added a guard clause to exit early if
sessionId is falsy, preventing an invalid query.
SessionService.mjs (summarizeSession):
- Added a guard clause to exit early if
sessionId is falsy. This is a critical safety check to prevent the service from accidentally summarizing the entire memory collection.
SessionService.mjs (findUnsummarizedSessions):
- Added a
.filter(Boolean) to the list of session IDs. This ensures that any null or undefined session IDs are removed at the source, preventing invalid data from being passed to downstream methods.
These changes collectively prevent a class of potential runtime errors and make the data service layer more resilient.
This ticket documents a series of fixes to improve the robustness of our ChromaDB query services within the Memory Core. The ChromaDB client throws an error when a
whereclause is constructed with anundefinedvalue (e.g.,where: { category: undefined }).To address this, the following changes were made:
SummaryService.mjs(querySummaries):queryobject. Thewhereclause is now only added if acategoryis provided.MemoryService.mjs(queryMemories):whereclause is only added if asessionIdis provided.MemoryService.mjs(listMemories):sessionIdis falsy, preventing an invalid query.SessionService.mjs(summarizeSession):sessionIdis falsy. This is a critical safety check to prevent the service from accidentally summarizing the entire memory collection.SessionService.mjs(findUnsummarizedSessions):.filter(Boolean)to the list of session IDs. This ensures that anynullorundefinedsession IDs are removed at the source, preventing invalid data from being passed to downstream methods.These changes collectively prevent a class of potential runtime errors and make the data service layer more resilient.