diff --git a/backend/shonar/api/v1/recordings.py b/backend/shonar/api/v1/recordings.py index 65cfaa0..73a745a 100644 --- a/backend/shonar/api/v1/recordings.py +++ b/backend/shonar/api/v1/recordings.py @@ -86,7 +86,13 @@ async def create_upload(body: UploadSessionCreate, user: CurrentUser, session: S session, user.id, body.declared_mime_type, body.declared_size_bytes, body.title, body.client_recording_id, body.transcription_model, ) + # Commit BEFORE responding: FastAPI's get_session commits after the + # response is sent, and the desktop client GETs /uploads/{id} the + # instant it sees the 201 — an uncommitted row raced that follow-up + # into a 404 "Upload status failed" (seen live Sep 18). + await session.commit() except up.UploadError as e: + await session.rollback() raise HTTPException(e.status_code, e.message) from None return us