Fix re-summarize running one voice behind: commit the job row before poking the inline queue.

The reprocess endpoint poked transport_enqueue while its request session
was still uncommitted; the inline worker woke instantly, read the job row
with its own session, and summarized with the PREVIOUS click's tone
(TRACE: click Funny -> worker read 'dry, witty'; click Neutral -> ran
'funny'). The UI disabled the voice chips for the whole wrong-voice run,
which read as 'spinner does nothing until I leave and come back'.

Rows are the real queue: commit before the poke. Regression test pins
worker tone to the requested tone and Neutral clearing a prior voice;
verified red without the fix, green with it.
This commit is contained in:
avi 2026-09-18 17:03:37 -05:00
commit 11bb13cb3d
3 changed files with 54 additions and 0 deletions

View file

@ -441,6 +441,14 @@ async def reprocess_recording(
rec.processing_status = ProcessingStatus.processing
rec.processing_error = None
await session.flush()
# Commit BEFORE poking the queue: the inline worker wakes the moment
# the item lands in the asyncio queue and reads the job row with its
# OWN session, while this request session only commits after the
# response completes. Without this the worker summarizes with the
# PREVIOUS click's tone (TRACE showed every click running one voice
# behind: click Funny -> worker read 'dry, witty'). The rows are the
# real queue; they must be durable before the poke.
await session.commit()
await proc.transport_enqueue(job_type, rec.id)
rows = await session.scalars(
select(ProcessingJob)