Skip to content

discovery(rag): NeuralMeshRetriever never injected into RAGService._mesh_retriever in production — mesh_retriever_enabled flag permanently dead #4686

@mrveiss

Description

@mrveiss

Discovery

Issues #2059 and #2056 (Neural Mesh RAG Phase 3) are closed, but RAGService._mesh_retriever is never assigned in any non-test production code path. The mesh_retriever_enabled config flag defaults to False, so even if a NeuralMeshRetriever instance existed, it would not be used.

Evidence

rag_service.py:71 — field defaults to None and is never set outside tests:

self._mesh_retriever: Optional[Any] = None
# "set externally when Phase 3 is active" — but nothing sets it

rag_service.py:616 — guarded by two conditions, both always False in production:

if self.config.mesh_retriever_enabled and self._mesh_retriever is not None:
    return await self._run_mesh_retriever(query, max_results)

Grep result for _mesh_retriever = across all non-test Python files:

(empty — only test files assign it)

rag_config.py:61:

mesh_retriever_enabled: bool = False  # never flipped to True in production

The only non-test reference is services/neural_mesh/query_decomposer.py:102:

self.mesh_retriever = mesh_retriever  # different attribute, different class

Impact

  • NeuralMeshRetriever service exists with tests but is never called in production
  • The entire Neural Mesh RAG Phase 3 retrieval path is dead code
  • RAG always falls through to AdvancedRAGOptimizer regardless of config
  • mesh_retriever_enabled in RAGConfig / GET /api/rag/config response is misleading — turning it on does nothing

Fix Options

  1. Wire it up: Find where NeuralMeshRetriever is instantiated and inject it into RAGService._mesh_retriever during app startup (in the relevant API startup/lifespan handler)
  2. Remove it: If Phase 3 was abandoned, remove _mesh_retriever, _run_mesh_retriever(), mesh_retriever_enabled, and the mesh test file — clean dead code

Needs investigation to determine which path is correct.

Affected Files

  • autobot-backend/services/rag_service.py_mesh_retriever field + _run_mesh_retriever()
  • autobot-backend/services/rag_config.pymesh_retriever_enabled
  • autobot-backend/services/neural_mesh/NeuralMeshRetriever implementation (check if still intended)

Metadata

Metadata

Assignees

No one assigned

    Labels

    backendbugSomething isn't workingnot-wiredImplemented but not connected to apprag

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions