Skip to content

Commit 47800a1

Browse files
committed
Fix eval-harness Windows CI failure: close the Chroma client before its TemporaryDirectory tears down
1 parent 5d45624 commit 47800a1

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

src/personal_llm/eval/cases.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ def run():
7171
text="Zaid is building Personal LLM, a local-first memory engine.",
7272
doc_id="doc-1", source="notes.md", extract_kg=False,
7373
)
74-
return ask(store, vectors, router, "What is Zaid building?")
74+
result = ask(store, vectors, router, "What is Zaid building?")
75+
vectors.close()
76+
return result
7577

7678
return EvalCase(
7779
name="rag_grounded_answer_cites_source",
@@ -90,7 +92,9 @@ def run():
9092
store = MemoryStore(str(Path(tmp) / "test.db"))
9193
vectors = VectorStore(str(Path(tmp) / "chroma"))
9294
router = _ScriptedRouter()
93-
return ask(store, vectors, router, "anything at all, memory is empty")
95+
result = ask(store, vectors, router, "anything at all, memory is empty")
96+
vectors.close()
97+
return result
9498

9599
return EvalCase(
96100
name="rag_empty_memory_says_not_in_memory",

src/personal_llm/memory/vectors.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,13 @@ def query(self, vector: list[float], k: int = 8) -> list[tuple[str, float, dict]
3939

4040
def count(self) -> int:
4141
return self._collection.count()
42+
43+
def close(self) -> None:
44+
"""Release the underlying sqlite handle.
45+
46+
Chroma's PersistentClient keeps chroma.sqlite3 open until this is called (or
47+
the client is garbage-collected), which races a TemporaryDirectory's cleanup
48+
on Windows (WinError 32: file in use) - callers using a temp persist_dir must
49+
call this before the directory context exits.
50+
"""
51+
self._client.close()

0 commit comments

Comments
 (0)