~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.
Password changes now add defense-in-depth cross-worker serialization and durable UUID epochs so stale SQLCipher engine caches are rejected across processes. This fencing does not revoke already-checked-out sessions or arbitrary writers that bypass the research-start gate.
The database manager's SQLCipher connections now set busy_timeout before
verifying the key, so a correct password is no longer counted as wrong when
another connection holds a lock briefly; a lock held for longer than the
busy timeout (db_config.busy_timeout_ms, 30 seconds by default) can still
fail verification. check_database_integrity runs
cipher_integrity_check only after a PASSIVE checkpoint has moved every WAL
frame into the main database file; otherwise quick_check is the verdict, so
while a reader pins the WAL, damage confined to free-list pages may go
unreported. The integrity scans run after the user's rekey locks are
released, so the scan itself never holds up that user's other requests, the
shared log-writer thread (which stores logs for every user) or the
idle-connection sweep. A close or idle-sweep disposal that runs during a
scan still holds those locks while its checkpoint waits for the scan's read
transaction, for at most one second. A password change committed during a
scan can make that check report a failure. The rekey lock sidecars are refused when they are not a regular
file (EINVAL), are already unlinked (EMLINK), or are a hard link to another
file in the same directory, such as the user's own or another user's
database, WAL or shm file (EMLINK, refused before it is opened, since closing
a descriptor to a database would drop SQLite's locks on it). This checks
current directory entries, not an inode's history: removing the other name
before the check leaves one link and defeats this detection. The data
directory must remain trusted. A hard-linked one
whose other names are all outside the directory (a backup or snapshot tool
that hard-links the data directory) is locked without changing its mode, instead of locking the user
out. The epoch files (.rekey.epoch,
.rekey.pending), which every probe reads while it holds the sidecar lock,
are opened without following a symlink and without waiting on a FIFO: a
symlink (ELOOP) or anything that is not a regular file (EINVAL) is an epoch
read fault, and a file longer than the 36-byte token is a malformed token,
refused without being read, so a file planted there cannot hang the probes
or the shutdown, or fill memory.
When a rekey sidecar cannot be opened or locked (for example fd exhaustion,
EROFS or EACCES), or an epoch file cannot be read once the sidecar is open,
the cached engine is kept and re-checked on the next successful probe, and
the periodic connection-pool reset skips that engine for the sweep instead
of disposing it. The metrics writer and the log writer treat the fault as
no usable connection rather than raising it. DatabaseManager.get_session
raises it instead of answering no session. Settings read without a session
of their own (get_settings_manager without one) take "no session" to mean
that the user has no database and answer from the defaults file, so during
the fault a stored strict or private_only egress scope read as the
default adaptive (so the journal-data download could go ahead), and a
custom library storage path read as the default directory (so a library
sync could remove the documents whose files it did not find there). Those
reads now fail closed; a route that leaves the error unhandled answers with
the 503 below. A signed-in request whose engine is kept this way is answered
with a 503 and Retry-After, and its session and stored password are kept
rather than logged out. So is a signed-in request with no engine cached
whose reopen of the database fails with such a fault or another rekey
operational error, instead of reading as a failed credential (a 401, which
the home page turns into a logout). The fault can also show only after the
authentication check passed, when the request opens its own database
session (an fd-exhaustion spike comes and goes): get_user_db_session then
raises DatabaseSessionUnavailableError, a DatabaseSessionError subclass,
for any rekey operational error while it opens or claims the database, and
the home page answers it with that 503 instead of logging the user out. A
browser that opens the home page during the fault gets that 503 as an error
page with a button that retries the home page, rather than a raw JSON body.
The app's exception handler answers with the same 503 when a route leaves
that error, or a rekey operational error itself, unhandled; a route that
catches it answers with its own error response, and none ends the session
over it. A failure to release the rekey sidecar lock after the code it
protects finished is raised (as RekeySidecarIOError) even when the lock
was taken inside an exception handler; it used to be added as a note to the
exception being handled and dropped, so a probe made there reported a
connection the release had failed for. Opening the
database while such a fault hides a cached engine fails at once with the
typed error (a login answers 503, not counted toward lockout), without first
spending a full key derivation (PBKDF2) on a cold open that needs the same
sidecar. The rekey epoch state is read
pending-first, so a reader that does not hold the rekey sidecar lock cannot
report an epoch that a concurrent password-change commit superseded as
stable. In this release the lock-free readers include session and socket
identity validation and the classification of a password-change failure
raised after the lock was released. Cache probes, logins and password
changes read the epoch under the lock.
These waits for a user's rekey sidecar give up after 5 seconds: the cache
claim behind every authenticated request (and behind is_user_connected,
probe_user_connection, get_session and an open of a cached database),
which counts the per-user lock it queues on toward the same bound, every
cold open, a login's included, and the epoch initialization at registration.
Within one HTTP request they share that bound: an authenticated request
claims the sidecar up to four times before its route runs (checking for an
open database and reopening it, then the authentication check's two probes),
and after one of a request's waits gives up, each later one tries once
without waiting, until one of them gets the sidecar again. So a request
waits out the bound at most once while the sidecar stays held, rather than
once per claim (about 20 seconds before a 503 that says Retry-After: 5). A
background research or indexing job that copied the request's context stops
sharing its wait budget when that request ends, including on an exception;
each later background claim gets its own bounded wait. A
holder can keep the sidecar far longer: another worker's password change of
a large database, a stopped process, a hung mount. Past the bound the wait
fails as RekeyLockContentionError, one more of the faults above: a
signed-in request is answered with the 503 and Retry-After, its session
kept, whether its engine was cached or its reopen of the database is what
gave up; a login with a 503 that is not counted toward lockout; and a
registration fails and removes its partial database. The shared log-writer
thread runs outside any request: it waits up to the bound for each of its
two claims of an entry and drops the entry when one gives up, so an entry
for that user waits at most two bounds for the sidecar rather than as long
as the holder keeps it. The entries queued behind it, every other user's
included, wait meanwhile, and entries that arrive while the queue is full
are dropped.
A password change proceeds while another connection holds a read
transaction open: the pre-rekey checkpoint is PASSIVE and best-effort, and
the post-rekey checkpoint, like the checkpoint before an engine disposal,
waits at most one second (or the busy timeout, if lower) for that reader,
because the user's sidecar lock is held meanwhile. When the post-rekey checkpoint cannot
complete, the change still succeeds and the live database already rejects
the old password, but the re-encrypted pages are only in the WAL: until a
later checkpoint completes (the last connection to the file closing, an
engine disposal, or automatic checkpoints after later writes, once the
reader has finished), the main database file on its own, and any WAL frames
written before the rekey, are still encrypted under the old password. The
rekey's durability comes from SQLite itself (the rekey commits under
synchronous=FULL and a complete checkpoint syncs the main file): the
manager never opens its own descriptor on the live database or its WAL,
because closing one would release every POSIX lock the process holds on
that file behind SQLite's back. A filesystem that cannot fsync a directory
(EINVAL/ENOTSUP) no longer fails every epoch publication, and an I/O failure
while publishing the first epoch at login is reported as a sidecar error
(503, not counted toward lockout) instead of a server error.
SQLCipher's PRAGMA rekey reports success without changing the key when
another connection holds a write transaction for longer than the busy
timeout. The new password is always proven by reopening the database with
it before the new epoch is committed; when it does not open and the old
password still does, the password change now fails as retryable (503) with
the old password still valid and no pending state left behind, instead of
an indeterminate outcome that only a login with the old password could
repair. If the epoch cannot be read right after a login has proved the
password, or it then shows a pending or different committed epoch, the
login answers 503 (not counted toward lockout) instead of reporting an
invalid password.
A password change whose new password has been proven (it decrypts the
database) is reported as completed even when the new epoch cannot be
committed (disk full, an I/O error); the pending epoch stays on disk, keeps
cached connections fenced, and the next login with the new password commits
it. When the outcome is indeterminate (the new password may be active), the
change-password page no longer answers like a retryable failure: every
session of the user is ended on every device, both stored copies of the
password, the scheduler's credential and live sockets are dropped, and the
user is told to try the new password first. The login that resolves the
pending change deletes only backups proven to use a superseded key,
including verification that their salt matches the live database's; a
backup whose salt cannot be verified is kept with an unknown key.
Cleanup reacquires the rekey lock, requires the login's recovered epoch to
still be current, and holds that lock through backup checks and deletion,
so it cannot delete backups made under a later password change. Which
password is active is decided by whether it decrypts the database's schema
page; quick_check and cipher_integrity_check findings (a database that
was already damaged) are logged as warnings instead of leaving the pending
state in place, which had answered every login with 503 for good. A cold
open waits for the user's per-user open lock no longer than for the rekey
sidecar (5 seconds), so concurrent opens during a long password change fail
together with a retryable 503 instead of one after another on the shared
worker threads. Registering a user creates a fresh epoch instead of reusing
one left beside an earlier database at the same path. See
docs/security/rekey-recovery.md for the files involved, the log lines and
manual recovery.
A correct password whose verification read met a database locked or busy
past the busy timeout (or an I/O error) was reported as a wrong password:
the login counted a lockout strike and a password change said "Current
password is incorrect". Such a failure now raises
DatabaseKeyCheckUnavailableError, a rekey operational error: a login
answers 503 without a strike, a signed-in reopen keeps the session, and a
password change fails as retryable. Only SQLite's wrong-key answer ("file is
not a database") still counts as a wrong password.