HIGH: Receipt OCR background task uses store closed by FastAPI dependency #91
Labels
No labels
accessibility
backlog
beta-feedback
bug
duplicate
enhancement
feature-request
help wanted
invalid
needs-design
needs-triage
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: Circuit-Forge/kiwi#91
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
The receipt OCR background task (
_process_receipt_ocr) receives astorethat has already been closed by FastAPI's dependency cleanup before the background task runs. This causes silent failures or crashes during OCR processing.Root Cause
app/api/endpoints/receipts.py:app/db/session.py:Fix
Open a new Store inside the background task function instead of passing the request-scoped one:
Then pass
session.db(a Path) to the task instead of the store:Same fix needed in
upload_receipts_batch.