Repository navigation
fix(sqlite): report lock contention as retryable - #512
Open
chuiwenwei wants to merge 1 commit into
Open
chuiwenwei wants to merge 1 commit into
chuiwenwei wants to merge 1 commit into
Conversation
A SQLite writer that loses the lock race raises OperationalError and becomes HTTP 500. The condition is transient, so session_scope now classifies it as DatabaseBusyError and the API maps that to 503 + Retry-After: 1 with the DATABASE_BUSY code. Non-lock OperationalErrors still propagate unchanged, so a malformed statement is not mislabelled as retryable. Refs EverMind-AI#498.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
SQLITE_BUSY/SQLITE_LOCKEDfailures asDatabaseBusyError503 DATABASE_BUSYwithRetry-After: 1OperationalErrors unchangedproduction handler set
Closes #498.
Automatic retry is intentionally avoided in the generic
session_scope:replaying an arbitrary transaction after the context body has executed could
duplicate caller-side effects. This change instead exposes an explicit
retryable API contract.
Area
Verification
Additional regression coverage:
BEGIN IMMEDIATE(
tests/integration/test_api/test_sqlite_busy_retry.py)OperationalErrorremains unchanged503 DATABASE_BUSYwithRetry-After: 1Checklist
main..envfiles, dependency folders, or generated output.Notes for Reviewers
The classifier prefers SQLite's primary result codes and retains message
matching as a fallback for wrappers that do not expose
sqlite_errorcode.Please pay particular attention to whether
DATABASE_BUSYshould remain adedicated public error code or reuse the generic infrastructure error code.
not the full
/flushroute;/flushreaches the samesession_scope.DatabaseBusyErroris aStorageErrortoday. If you want the cascadeworker to retry it inline (like
VectorStoreBusyError), moving it underExternalServiceErroror adding a retryable-storage branch is a smallfollow-up — happy to do it.
following fix(reflection): batch source deprecation, revert it on failure, cap sources per merge #445.
By submitting this pull request, I agree that my contribution is licensed under
the Apache License 2.0.