Private
Public Access
fix(rag): log when index_file silently no-ops on missing file
Per Tier 1 addendum 3 (the 4th red flag): index_file had a silent `if not os.path.exists(full_path): return` no-op. When the RAG engine is misconfigured (e.g. stale active_project_path from a prior test's project switch), the files are not found and index_file silently returns. The user sees an empty collection with no indication of why. Fix: emit a stderr.write with base_dir, file_path, and cwd when the file is not found. This makes the misconfiguration visible in the subprocess log (tests/logs/sloppy_py_test.log) instead of invisible. This would have made the "index_file not called" diagnostic trivial during the 3-session investigation of test_rag_phase4_final_verify. Note: the test still fails (RAG search returns 0 chunks) even with the proper project switch + this log fix. The exact root cause of the empty collection is still under investigation.
This commit is contained in:
@@ -335,6 +335,15 @@ class RAGEngine:
|
|||||||
if os.path.exists(cwd_path):
|
if os.path.exists(cwd_path):
|
||||||
full_path = cwd_path
|
full_path = cwd_path
|
||||||
else:
|
else:
|
||||||
|
# Per Tier 1 addendum 3: log when index_file silently no-ops on a
|
||||||
|
# missing file. This makes misconfigured base_dir visible in the
|
||||||
|
# subprocess log instead of invisible (a real production bug that
|
||||||
|
# made this diagnostic chain 3 sessions long).
|
||||||
|
sys.stderr.write(
|
||||||
|
f"RAG index_file: file not found, base_dir={self.base_dir!r} "
|
||||||
|
f"file_path={file_path!r} cwd={os.getcwd()!r}\n"
|
||||||
|
)
|
||||||
|
sys.stderr.flush()
|
||||||
return
|
return
|
||||||
|
|
||||||
mtime_result = self._get_file_mtime_result(full_path)
|
mtime_result = self._get_file_mtime_result(full_path)
|
||||||
|
|||||||
Reference in New Issue
Block a user