DeepTutor: Lifelong Personalized Tutoring. https://deeptutor.info/.
Python ai-agentsai-tutorclawbotcli-tooldeepresearchinteractive-learninglearningmulti-agent-systemsrag
fix: prevent FD exhaustion
Eve Kolbb62059263c4e
diff --git a/deeptutor/services/session/sqlite_store.py b/deeptutor/services/session/sqlite_store.pyindex c23fd8fca..165f0ed67 100644--- a/deeptutor/services/session/sqlite_store.py+++ b/deeptutor/services/session/sqlite_store.py@@ -5,6 +5,8 @@ SQLite-backed unified chat session store.from __future__ import annotationsimport asyncio+from collections.abc import Iterator+from contextlib import contextmanagerfrom dataclasses import dataclassimport jsonimport os@@ -257,11 +259,20 @@ class SQLiteSessionStore:async with self._lock:return await asyncio.to_thread(fn, *args)- def _connect(self) -> sqlite3.Connection:+ @contextmanager+ def _connect(self) -> Iterator[sqlite3.Connection]:+ # sqlite3.Connection's own context manager commits/rolls back but does+ # NOT close the connection — so naked `with sqlite3.connect(...)` leaks+ # one FD per call until GC. Wrap it so each call site gets both+ # transaction semantics and deterministic close.conn = sqlite3.connect(self.db_path)conn.row_factory = sqlite3.Rowconn.execute("PRAGMA foreign_keys = ON")- return conn+ try:+ with conn:+ yield conn+ finally:+ conn.close()def _create_session_sync(self,