Repository navigation
refactor(rag): de-fork graph retrieval — one neighbour contract, one graph blend, shared config (#18139, #18141) - #18421
Conversation
… shared rerank weights and stale filter on the mesh branch (#18141)
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 47 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
✅ SSOT Configuration Compliance: Passing🎉 No new hardcoded values of either class — Known backlog in |
|
Review (Sonnet) at 8522b85: changes requested (one Medium). Every AC of #18139 is met:
For #18141: one
|
|
Delta review at 3b120cf: approve. The timeout Medium is resolved.
Queued for the next merge train. |
Thinking Path
Two issues share the RAG graph-retrieval files, so one branch and one PR. #18139: the
get_neighborscontract was forked across PPR (to_nodedicts,min_weightkwarg), the PostgreSQL adapter (tuples, nomin_weight), staleness BFS and edge sync, so PPR wired with the adapter raisedTypeErroron first use. #18141: graph-RAG and the Neural Mesh retriever blended graph signals with different formulas, weights, config and rerank weights, and the mesh branch skipped the stale-chunk filter. Fix each at its root with one definition per concept.What Changed
#18139
services/mesh_brain/neighbor_store.py: the oneNeighborStoreProtocol,get_neighbors(node_id, min_weight=0.0) -> list[tuple[str, float]], anddecode_neighbors.MeshDBAdapter, the Redis staleness adapter andMeshEdgeSyncall conform; the duplicateMeshGraphand PPRNeighborStoreProtocols are gone. The raw dict-row query onMeshDBis renamedfetch_neighbor_rows(it is not a neighbour-contract implementation).MeshDBAdapter. Before:MeshDBAdapter.get_neighbors(node_id)took nomin_weight, so PPR'sget_neighbors(node_id, min_weight=...)raisedTypeError.#18141
knowledge/search_components/graph_blend.py:blend_graph_score, the one pre-rerank blend;compute_blended_scorestays the one post-rerank blend.RAGConfig.graph_weight(envAUTOBOT_RAG_GRAPH_WEIGHT, registered) andgraph_traversal_depth; defaults inconstants/rag_graph_constants.py.RAGConfig(timeout_seconds=10.0)or restates 0.3. The graph path keeps its 10 s default as the env-backedRAGConfig.graph_timeout_secondsfield.NeuralMeshRetrievertakesconfig, blends withblend_graph_scoreand passesconfig.rerank_weights(incl. MMR) on every rerank;rag_servicepasses its config. The mesh branch now runs_filter_stale_chunks, onRankedResultobjects (reranker dicts are converted byMeshRetrievalResult.ranked_chunks).TraverseRequest, and the multi-source graph request;PersonalizedPageRank.rank(max_hops=...)takes its default from the same module.Behavioural differences resolved
(1-w)*base + w*base*strength, w=0.3blend_graph_score(base, base*strength, w)score + ppr_boost(unweighted, unbounded)blend_graph_score(score, ppr, w)w * pprRAGConfigRAGConfig.graph_timeout_seconds(AUTOBOT_RAG_GRAPH_TIMEOUT_SECONDS)RerankWeights()default, no MMRRAGConfig.rerank_weightsNot changed, on purpose: the depth fields defaulting to 1 and 6 (path length) in
schemas_knowledge.pyare different concepts; mesh SIMPLE tier returns un-reranked chunks by design;symbol_fork_baseline.jsonhas no cluster for the removed duplicate Protocols (they were different names), so no row to lower. Ceilings lowered forschemas_knowledge.py(5155),lifespan.py(2338),graph_rag_service.py(738) in both records.Verification
pytest services/ tests/test_rag_rerank_weights.py tests/test_session_adaptive_reranker.py tests/test_mmr_diversity.py tests/memory_graph knowledge/search_components advanced_rag_optimizer_test.py: 3508 passed.services/mesh_brain: 181 passed before the blend commit; newrag_graph_blend_18141_test.py: 12 passed.repo_tests:symbol_fork_ratchet_17312,python_file_size_ratchet,ceiling_record_parity_17872,guard_reach_meta: pass;reach_scope_claim_17844alone: 10 passed.knowledge/run showedegress_vendor_behaviour_test.pyfailures only under ordering ("Event loop is closed"); in isolation it passes (105 passed with the graph-RAG and memory-graph tests).knowledge/chat_knowledge_system_e2e_test.pyneeds live services and was not run.Closes #18139
Refs #18141 (blend, config, rerank weights, stale filter and depth done; KAG has no retrieval branch to test, only the dispatcher routes it)
Model Used
Claude Sonnet 5.5
🤖 Generated with Claude Code