Skip to content

Commit 882cc10

Browse files
fix(memory-core): add boundary guards to CollectionProxy and fix config key (#10504) (#10505)
* fix(memory-core): add boundary guards to CollectionProxy and fix config key (#10504) * fix(memory-core): address PR review feedback (#10504) * test(memory-core): fix environment variable names in SessionSummarization spec (#10504) --------- Co-authored-by: tobiu <tobiasuhlig78@gmail.com>
1 parent a02e1c6 commit 882cc10

2 files changed

Lines changed: 13 additions & 5 deletions

File tree

ai/mcp/server/memory-core/managers/CollectionProxy.mjs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class CollectionProxy extends Base {
1919
}
2020

2121
async getManagers() {
22-
const architecture = aiConfig.architecture || 'hybrid';
22+
const architecture = aiConfig.engine || 'hybrid';
2323
const managers = [];
2424

2525
// In Hybrid RAG, vectors exclusively live in ChromaDB
@@ -57,16 +57,25 @@ class CollectionProxy extends Base {
5757

5858
async get(args) {
5959
const collections = await this.getCollections();
60+
if (!collections || collections.length === 0 || !collections[0]) {
61+
throw new Error(`[CollectionProxy] get() failed: No underlying collection available for type '${this.collectionType}'`);
62+
}
6063
return collections[0].get(args);
6164
}
6265

6366
async query(args) {
6467
const collections = await this.getCollections();
68+
if (!collections || collections.length === 0 || !collections[0]) {
69+
throw new Error(`[CollectionProxy] query() failed: No underlying collection available for type '${this.collectionType}'`);
70+
}
6571
return collections[0].query(args);
6672
}
6773

6874
async count() {
6975
const collections = await this.getCollections();
76+
if (!collections || collections.length === 0 || !collections[0]) {
77+
throw new Error(`[CollectionProxy] count() failed: No underlying collection available for type '${this.collectionType}'`);
78+
}
7079
return collections[0].count();
7180
}
7281

test/playwright/unit/ai/mcp/server/memory-core/services/SessionSummarization.spec.mjs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import {setup} from '../../../../../../setup.mjs';
22

33
const appName = 'MemoryCoreTest';
44

5-
process.env.MODEL_PROVIDER = 'openAiCompatible';
6-
process.env.OPENAI_COMPATIBLE_MODEL = 'gemma4';
5+
process.env.NEO_MODEL_PROVIDER = 'openAiCompatible';
6+
process.env.NEO_OPENAI_COMPATIBLE_MODEL = 'gemma4';
77

88
setup({
99
neoConfig: {
@@ -50,8 +50,7 @@ test.describe('Memory Core Offline Summarization', () => {
5050

5151
const testDbName = `memory-core-session-test-${process.pid}-${Date.now()}.sqlite`;
5252
const testDbPath = path.join(tmpDir, testDbName);
53-
aiConfig.engines.neo.dataDir = tmpDir;
54-
aiConfig.engines.neo.filename = testDbName;
53+
aiConfig.storagePaths.graph = testDbPath;
5554

5655
// Remove existing test db
5756
if (fs.existsSync(testDbPath)) {

0 commit comments

Comments
 (0)