fix(rag): Resolve RAG test failures and race conditions

- Fixed circular import in chromadb by using lazy imports in 
ag_engine.py.
- Moved RAG engine initialization to background threads in AppController to avoid blocking UI.
- Added _rag_engine_lock to prevent race conditions during engine re-initialization.
- Updated Gemini embedding model to gemini-embedding-001 (available) from 	ext-embedding-004 (not found).
- Fixed _rebuild_rag_index to use fresh 
ag_engine instance from self in every iteration.
- Optimized 	est_rag_phase4_final_verify.py and 	est_rag_phase4_stress.py to wait for RAG sync before continuing.
- Added dummy embedding fallback in LocalEmbeddingProvider if sentence-transformers fails to load.
This commit is contained in:
2026-05-14 22:23:48 -04:00
parent 07ddcf068b
commit 2d76381796
5 changed files with 115 additions and 55 deletions
+7 -4
View File
@@ -34,11 +34,14 @@ def test_phase4_final_verify(live_gui):
client.set_value('current_provider', 'gemini_cli')
client.set_value('gcli_path', os.path.abspath(os.path.join(os.path.dirname(__file__), "mock_gcli.bat")))
# Wait for settings to apply
for _ in range(50):
if client.get_value('rag_emb_provider') == 'local':
# Wait for settings to apply and engine to sync
success = False
for _ in range(100):
if client.get_value('rag_emb_provider') == 'local' and client.get_value('rag_status') == 'ready':
success = True
break
time.sleep(0.1)
time.sleep(0.5)
assert success, f"RAG sync failed. Status: {client.get_value('rag_status')}"
# 3. Trigger Initial Indexing
print("[VERIFY] Triggering indexing...")