Bug Description
In brute_force_triplet_search (cognee/modules/retrieval/utils/brute_force_triplet_search.py), the neighborhood re-scoring step passes the expansion node ids as node_name. But node_name filters on belongs_to_set, which never contains a node's own id, so the search returns nothing. The expansion nodes then keep the default triplet_distance_penalty and always rank last, which defeats the purpose of the block.
Steps to Reproduce
- Run a retrieval that reaches
brute_force_triplet_search with neighborhood_depth set, so there are expansion nodes.
- The extra re-score search returns nothing, and the expansion nodes stay at the default penalty regardless of similarity.
Expected Behavior
Expansion nodes get real vector scores and take part in triplet ranking.
Actual Behavior
node_name=expansion_ids filters on belongs_to_set, matches nothing, returns [], so expansion nodes keep the default penalty.
Environment
- OS: any
- Python version: 3.10 - 3.13
- Cognee version: dev
- LLM Provider: any
- Database: Vector store LanceDB or PGVector (both filter node_name on belongs_to_set)
Logs/Error Messages
None. Silent bug, expansion nodes just always rank last.
Additional Context
Fix in PR #3913. It runs an unfiltered search and keeps only the expansion ids, and removes a dead batch branch in the same block. search() has no id filter today, so an alternative is to add one to the vector adapters. Noted in the PR for maintainer preference.
Pre-submission Checklist
Bug Description
In
brute_force_triplet_search(cognee/modules/retrieval/utils/brute_force_triplet_search.py), the neighborhood re-scoring step passes the expansion node ids asnode_name. Butnode_namefilters onbelongs_to_set, which never contains a node's own id, so the search returns nothing. The expansion nodes then keep the defaulttriplet_distance_penaltyand always rank last, which defeats the purpose of the block.Steps to Reproduce
brute_force_triplet_searchwithneighborhood_depthset, so there are expansion nodes.Expected Behavior
Expansion nodes get real vector scores and take part in triplet ranking.
Actual Behavior
node_name=expansion_idsfilters onbelongs_to_set, matches nothing, returns[], so expansion nodes keep the default penalty.Environment
Logs/Error Messages
None. Silent bug, expansion nodes just always rank last.
Additional Context
Fix in PR #3913. It runs an unfiltered search and keeps only the expansion ids, and removes a dead batch branch in the same block.
search()has no id filter today, so an alternative is to add one to the vector adapters. Noted in the PR for maintainer preference.Pre-submission Checklist