Repository navigation
fix: keep IMAP reader alive during SQLite contention - #291
Conversation
There was a problem hiding this comment.
Reviewed the reader-side SQLite contention fix at 15780c5. The implementation keeps the retry boundary around individual queue operations, only retries SQLITE_BUSY / SQLITE_LOCKED-style failures, preserves fatal behavior for structural OperationalError failures, and the new tests cover real writer contention plus the mark_seen / last_uid boundary.
Validation run locally from a dedicated PR worktree:
- /tmp/gab-pr291-review-venv/bin/python -m pytest -q tests/test_reader.py -> 6 passed
I do not see a code-level blocker in the reader change. There is one merge blocker before this can land: GitHub reports the PR as conflicting, and git merge-tree shows the conflict is in docs/persistence.md against the already-merged session-event persistence paragraph from #289. Please rebase/merge current main and combine that paragraph so it mentions heartbeat, acknowledgement claims, streamed session-event writes, and individual IMAP reader storage operations consistently.
|
Confirmed against the current remote state: the PR head is still 15780c5, current main is 8b49fba, and GitHub still reports the branch as conflicting. The merge-tree conflict is limited to docs/persistence.md, where the session-event persistence text already on main must be combined with this PR’s IMAP reader retry text. This dispatch is review-only, so I have not rebased or modified the branch. The next required step is an author-side branch update resolving that paragraph, followed by the full test suite/CI on the updated head. The code-level review remains positive, but final approval should wait until the updated branch is mergeable against current main and revalidated. |
|
@giscebot resol conflictes |
Co-authored-by: ecarreras <ecarreras@users.noreply.github.com>
|
Conflicte resolt i branca actualitzada.
PR: #291 |
|
Post-merge sync completed for #291.
No repository files were changed during this review-only cleanup. |
|
Post-merge cleanup follow-up: I found and removed the remaining clean worktree for the merged branch
PR: #291 |
Summary
SQLITE_BUSY/SQLITE_LOCKEDaround each IMAP reader storage operation\Seenside effectOperationalErrorfailures fatal and document the retry boundaryContext and risk
Sentry issue #285 shows SQLite contention terminating
github-agent-bridge-reader-run. The connection already waits up to 30 seconds, so merely increasing the timeout would defer the same failure. This change adds two bounded retries after genuine SQLite contention while preserving the reader's high-water invariant.The retry boundary is deliberately narrower than the whole IMAP pass. Ingestion remains protected by its source-key deduplication, and a lock while advancing
last_uidcannot replay an external mailbox mutation. Schema and storage errors such as a missing table still surface immediately.Validation
python3 -m pytest -q— 526 passed, 1 known Starlette/httpx deprecation warningBEGIN IMMEDIATElock and verifies recovery after release\SeenoperationOperationalErrorfailures are not retriedRequested by: automated Sentry alert #285 (trusted event metadata contained no human requester)
Closes #285