-
Notifications
You must be signed in to change notification settings - Fork 505
Description
Problem
syncIndexedCodebasesFromCloud() in handlers.ts calls vectorDb.query() with an empty filter string to extract codebasePath from collection metadata:
const results = await vectorDb.query(
collectionName,
'', // Empty filter to get all results
['metadata'],
1
);This query returns empty results on local Milvus standalone, even when the collection has data. This was also reported by @juanmlarios in #246.
Root Cause
In milvus-vectordb.ts:435-437, the empty string is passed as filter:
const queryParams: any = {
collection_name: collectionName,
filter: filter, // '' (empty string)
output_fields: outputFields,
};The Milvus Node SDK (@zilliz/milvus2-sdk-node) then processes this with:
data.expr = data.filter || data.expr || primaryKeyInIdsExpression;Since '' is falsy in JavaScript, '' || data.expr falls through to data.expr (which is undefined), then to primaryKeyInIdsExpression (also undefined). The final expression sent to the Milvus gRPC server is effectively empty/undefined, which may return no results depending on the Milvus server version.
Impact
This bug prevents syncIndexedCodebasesFromCloud() from discovering codebases in Milvus, which causes:
cloudCodebasesset remains empty- The sync removes all local codebases from the snapshot
search_codereturns "not indexed" error
This is the underlying cause of #145 and the blocker that stalled #246.
Suggested Fix
Replace the empty filter with an expression that is always truthy and matches all documents. For example:
// Option A: use a non-empty expression that matches everything
const results = await vectorDb.query(
collectionName,
'id != ""',
['metadata'],
1
);Or fix at the milvus-vectordb.ts level to handle empty filter correctly:
// Option B: in milvus-vectordb.ts query(), use 'expr' key instead of 'filter'
const queryParams: any = {
collection_name: collectionName,
expr: filter || undefined, // Let SDK handle the default
output_fields: outputFields,
};Related
- Indexing succeds but then search_code right after that says code base is not indexed #145 — search fails with "not indexed" after indexing
- fix: sync cloud codebases to local snapshot after MCP restart #246 — PR stalled because query returns empty
- fix: restore indexed codebases from Milvus to local snapshot after restart #278 — PR with defensive fixes that work around this issue