Skip to content

Personal AI, On Personal Devices

Python

fix(traces): allow TraceStore SQLite access from worker threads

Jon Saad-Falconae12d925bb8a
diff --git a/src/openjarvis/traces/store.py b/src/openjarvis/traces/store.py
index 0efce8a4..9c4ceb66 100644
--- a/src/openjarvis/traces/store.py
+++ b/src/openjarvis/traces/store.py
@@ -81,7 +81,11 @@ class TraceStore:
def __init__(self, db_path: str | Path) -> None:
self._db_path = str(db_path)
- self._conn = sqlite3.connect(self._db_path)
+ # check_same_thread=False is safe with WAL mode. The
+ # AgenticRunner dispatches agent work to a ThreadPoolExecutor
+ # (for Playwright compat), so trace writes may originate from
+ # a different thread than the one that opened the connection.
+ self._conn = sqlite3.connect(self._db_path, check_same_thread=False)
self._conn.execute("PRAGMA journal_mode=WAL")
self._conn.execute(_CREATE_TRACES)
self._conn.execute(_CREATE_STEPS)