Adds a Ping() call to sqliteutil.OpenDB to ensure the database connection is valid and the file can be opened.
This ensures that file permission or missing directory errors are caught and diagnosed immediately.
Assisted-By: cagent
Creates a new pkg/sqliteutil package to handle SQLite connection opening with consistent pragmas.
Enables foreign key support (_pragma=foreign_keys(1)) globally, fixing ignored cascade deletes in RAG strategies.
Refactors pkg/memory, pkg/session, and pkg/rag to use the new utility.
Fixes a resource leak in NewMemoryDatabase where the connection wasn't closed on table creation failure.
Assisted-By: cagent
Updates SQLite connection strings to use _pragma query parameters for busy_timeout and journal_mode configuration in both memory database and session store.
Removes redundant manual file cleanup in sqlite tests.
Assisted-By: cagent
Configure SQLite connections with proper concurrency handling to prevent
"database is locked" errors when multiple operations access the database
simultaneously.
Changes:
- Add busy_timeout (5s) to wait for locks instead of failing immediately
- Enable WAL mode for better concurrent read/write performance
- Configure connection pool to serialize writes (SQLite best practice)
Fixes session store and memory database SQLite implementations.