diff --git a/src/app_controller.py b/src/app_controller.py index 2a426b33..88d58e3a 100644 --- a/src/app_controller.py +++ b/src/app_controller.py @@ -1489,8 +1489,10 @@ class AppController: else: self._set_rag_status("ready") except Exception as e: + import traceback as _tb_investigate self._set_rag_status(f"error: {e}") - sys.stderr.write(f"[DEBUG RAG] Failed to sync engine: {e}\n") + sys.stderr.write(f"[RAG_INVESTIGATE] exception type={type(e).__name__}, module={type(e).__module__}, str={str(e)!r}\n") + sys.stderr.write(f"[RAG_INVESTIGATE] traceback:\n{_tb_investigate.format_exc()}\n") sys.stderr.flush() with self._rag_sync_lock: if not self._rag_sync_dirty: diff --git a/tests/test_rag_phase4_final_verify.py b/tests/test_rag_phase4_final_verify.py index 9631bb2a..4eb10ad0 100644 --- a/tests/test_rag_phase4_final_verify.py +++ b/tests/test_rag_phase4_final_verify.py @@ -16,7 +16,25 @@ from src import api_hook_client def test_phase4_final_verify(live_gui, live_gui_workspace): client = api_hook_client.ApiHookClient() assert client.wait_for_server(timeout=15), "Hook server did not start" - + + # Clean the chroma cache BEFORE the test starts. In batched live_gui + # context, the live_gui subprocess is shared across many tests, and + # prior tests leave chroma state at the controller's project root + # (e.g. C:\projects\manual_slop\tests\artifacts\.slop_cache\chroma_test_*). + # The dim-mismatch rmtree in rag_engine._validate_collection_dim + # fails on Windows with WinError 32 (file in use), leaving a stale + # locked collection that PersistentClient can't open. Wipe the + # relevant cache dirs proactively so the test starts clean. + _workspace_root = str(live_gui_workspace.parent if live_gui_workspace else Path.cwd()) + stale_path = Path(_workspace_root) / ".slop_cache" + if stale_path.exists(): + for col_dir in stale_path.iterdir(): + if col_dir.is_dir() and col_dir.name.startswith("chroma_"): + try: + shutil.rmtree(col_dir) + except Exception: + pass + # 1. Setup mock project data workspace_dir = live_gui_workspace workspace_dir.mkdir(parents=True, exist_ok=True)