Repository navigation
Keep RAG WAL sidecars between database operations - #15719
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex review |
1 similar comment
|
@codex review |
|
@codex review |
1 similar comment
|
@codex review |
|
Codex Review: Something went wrong. Try again later by commenting “@codex review”. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review |
1 similar comment
|
@codex review |
|
Codex Review: Something went wrong. Try again later by commenting “@codex review”. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
…ot block account deletion [skip ci]
[skip ci]
## Summary `(Python 3.13, a-f)` fails on main and on every PR based on it (seen on the #15693 and #15761 staging runs) with two stale tests. Both product changes are intentional; the tests had not caught up. **1. `test_account_chat_settings.py::test_list_export_and_delete_stay_in_the_account`** ``` assert {'threads': [...Guards': True} == {'threads': []} Left contains 1 more item: {'threadPatchGuards': True} ``` #15685 advertises the chat-title repair guards on the thread lists (`threadPatchGuards` on the `/chat/threads` reply). This test checks that another account's thread stays invisible, but compared the whole reply to `{"threads": []}`. It now asserts the thread list itself is empty, which is the privacy claim. **2. `test_checkpoint_compaction.py::test_the_reachability_probe_closes_the_connection_it_opens`** ``` assert _open_archive_handles() <= before + 1 E assert 4 <= (0 + 1) ``` #15719 keeps one WAL keeper connection per `rag.db` for the life of the process (`storage/rag_db._ensure_wal_keeper`), holding `rag.db` plus its `-wal` and `-shm` sidecars. The first probe in a fresh process creates it, so the test counted the keeper's descriptors as a leak. It also failed when run alone, not only under xdist. The test now probes once to warm the keeper up, takes its baseline after that, and requires no growth at all over 50 probes. That is stricter than the old `before + 1`, and it is the leak the test exists for: one leaked probe connection per call. ## Testing - Both tests fail on main (`75555ccb54`) and pass with this change; `test_account_chat_settings.py` 93 passed. - Sabotage: replacing the `conn.close()` in `conversation_archive.reachable()` with a no-op makes the probe test fail with `assert 23 <= 5`.
An idle Unsloth backend opens and closes the RAG database several times on each linked-folder polling cycle. With no other connection open, SQLite deletes
rag.db-walandrag.db-shmafter each operation, then recreates them for the next one—even with an empty knowledge base.Keep one idle connection per resolved RAG database path, following the existing database keeper pattern. Operation connections remain independent; the keeper holds no transaction and requires no vector extension. Release it before account storage retirement and at backend shutdown, suppress late recreation during shutdown, and re-enable lazy creation for a new lifespan.
Native Windows 11 validation used Python 3.13.17 and SQLite 3.50.4:
Refs #15552. This removes confirmed unnecessary file churn. The reported Recycle Bin behavior remains under investigation: local native traces showed successful SQLite
DeleteFileWcalls and no Recycle Bin growth before or after the change. A further 120-second run with three released backends sharing one isolated database produced 61 WAL/SHM deletion pairs, all attributed to successful SQLiteDeleteFileWcalls in the three listener processes, with zero new Recycle Bin entries through graceful shutdown. The release comparison executed the published backend with existing native dependencies, not a clean reinstall of the packaged Desktop application.