@@ -211,15 +211,15 @@ def get_jobs(
211211 }
212212
213213
214- def all_jobs_complete_for_session ( session_id : str ) -> bool :
214+ def all_jobs_complete_for_client ( client_id : str ) -> bool :
215215 """
216- Check if all jobs associated with a session are in terminal states.
216+ Check if all jobs associated with a client are in terminal states.
217217
218- Only checks jobs with audio_uuid in job.meta (no backward compatibility) .
218+ Checks jobs with client_id in job.meta.
219219 Traverses dependency chains to include dependent jobs.
220220
221221 Args:
222- session_id : The audio_uuid (session ID) to check jobs for
222+ client_id : The client device identifier to check jobs for
223223
224224 Returns:
225225 True if all jobs are complete (or no jobs found), False if any job is still processing
@@ -248,7 +248,7 @@ def is_job_complete(job):
248248
249249 return True
250250
251- # Find all jobs for this session
251+ # Find all jobs for this client
252252 all_queues = [transcription_queue , memory_queue , audio_queue , default_queue ]
253253 for queue in all_queues :
254254 registries = [
@@ -266,8 +266,8 @@ def is_job_complete(job):
266266 try :
267267 job = Job .fetch (job_id , connection = redis_conn )
268268
269- # Only check jobs with audio_uuid in meta
270- if job .meta and job .meta .get ('audio_uuid ' ) == session_id :
269+ # Only check jobs with client_id in meta
270+ if job .meta and job .meta .get ('client_id ' ) == client_id :
271271 if not is_job_complete (job ):
272272 return False
273273 except Exception as e :
@@ -289,7 +289,7 @@ def start_streaming_jobs(
289289 2. Audio persistence job - writes audio chunks to WAV file (file rotation per conversation)
290290
291291 Args:
292- session_id: Stream session ID (audio_uuid )
292+ session_id: Stream session ID (equals client_id for streaming )
293293 user_id: User identifier
294294 client_id: Client identifier
295295
@@ -313,7 +313,7 @@ def start_streaming_jobs(
313313 failure_ttl = 86400 , # Cleanup failed jobs after 24h
314314 job_id = f"speech-detect_{ session_id [:12 ]} " ,
315315 description = f"Listening for speech..." ,
316- meta = {'audio_uuid' : session_id , ' client_id' : client_id , 'session_level' : True }
316+ meta = {'client_id' : client_id , 'session_level' : True }
317317 )
318318 # Log job enqueue with TTL information for debugging
319319 actual_ttl = redis_conn .ttl (f"rq:job:{ speech_job .id } " )
@@ -346,7 +346,7 @@ def start_streaming_jobs(
346346 failure_ttl = 86400 , # Cleanup failed jobs after 24h
347347 job_id = f"audio-persist_{ session_id [:12 ]} " ,
348348 description = f"Audio persistence for session { session_id [:12 ]} " ,
349- meta = {'audio_uuid ' : session_id , 'session_level' : True } # Mark as session-level job
349+ meta = {'client_id ' : client_id , 'session_level' : True } # Mark as session-level job
350350 )
351351 # Log job enqueue with TTL information for debugging
352352 actual_ttl = redis_conn .ttl (f"rq:job:{ audio_job .id } " )
@@ -366,7 +366,6 @@ def start_streaming_jobs(
366366
367367def start_post_conversation_jobs (
368368 conversation_id : str ,
369- audio_uuid : str ,
370369 user_id : str ,
371370 transcript_version_id : Optional [str ] = None ,
372371 depends_on_job = None ,
@@ -386,7 +385,6 @@ def start_post_conversation_jobs(
386385
387386 Args:
388387 conversation_id: Conversation identifier
389- audio_uuid: Audio UUID for job tracking
390388 user_id: User identifier
391389 transcript_version_id: Transcript version ID (auto-generated if None)
392390 depends_on_job: Optional job dependency for first job (e.g., transcription for file uploads)
@@ -402,7 +400,7 @@ def start_post_conversation_jobs(
402400 version_id = transcript_version_id or str (uuid .uuid4 ())
403401
404402 # Build job metadata (include client_id if provided for UI tracking)
405- job_meta = {'audio_uuid' : audio_uuid , ' conversation_id' : conversation_id }
403+ job_meta = {'conversation_id' : conversation_id }
406404 if client_id :
407405 job_meta ['client_id' ] = client_id
408406
@@ -416,7 +414,7 @@ def start_post_conversation_jobs(
416414
417415 if speaker_enabled :
418416 speaker_job_id = f"speaker_{ conversation_id [:12 ]} "
419- logger .info (f"🔍 DEBUG: Creating speaker job with job_id={ speaker_job_id } , conversation_id={ conversation_id [:12 ]} , audio_uuid= { audio_uuid [: 12 ] } " )
417+ logger .info (f"🔍 DEBUG: Creating speaker job with job_id={ speaker_job_id } , conversation_id={ conversation_id [:12 ]} " )
420418
421419 speaker_job = transcription_queue .enqueue (
422420 recognise_speakers_job ,
@@ -440,7 +438,7 @@ def start_post_conversation_jobs(
440438 # Step 2: Memory extraction job
441439 # Depends on speaker job if it was created, otherwise depends on upstream (transcription or nothing)
442440 memory_job_id = f"memory_{ conversation_id [:12 ]} "
443- logger .info (f"🔍 DEBUG: Creating memory job with job_id={ memory_job_id } , conversation_id={ conversation_id [:12 ]} , audio_uuid= { audio_uuid [: 12 ] } " )
441+ logger .info (f"🔍 DEBUG: Creating memory job with job_id={ memory_job_id } , conversation_id={ conversation_id [:12 ]} " )
444442
445443 memory_job = memory_queue .enqueue (
446444 process_memory_job ,
@@ -462,7 +460,7 @@ def start_post_conversation_jobs(
462460 # Step 3: Title/summary generation job
463461 # Depends on speaker job if enabled, otherwise on upstream dependency
464462 title_job_id = f"title_summary_{ conversation_id [:12 ]} "
465- logger .info (f"🔍 DEBUG: Creating title/summary job with job_id={ title_job_id } , conversation_id={ conversation_id [:12 ]} , audio_uuid= { audio_uuid [: 12 ] } " )
463+ logger .info (f"🔍 DEBUG: Creating title/summary job with job_id={ title_job_id } , conversation_id={ conversation_id [:12 ]} " )
466464
467465 title_summary_job = default_queue .enqueue (
468466 generate_title_summary_job ,
@@ -484,14 +482,13 @@ def start_post_conversation_jobs(
484482 # Step 5: Dispatch conversation.complete event (runs after both memory and title/summary complete)
485483 # This ensures plugins receive the event after all processing is done
486484 event_job_id = f"event_complete_{ conversation_id [:12 ]} "
487- logger .info (f"🔍 DEBUG: Creating conversation complete event job with job_id={ event_job_id } , conversation_id={ conversation_id [:12 ]} , audio_uuid= { audio_uuid [: 12 ] } " )
485+ logger .info (f"🔍 DEBUG: Creating conversation complete event job with job_id={ event_job_id } , conversation_id={ conversation_id [:12 ]} " )
488486
489487 # Event job depends on both memory and title/summary jobs completing
490488 # Use RQ's depends_on list to wait for both
491489 event_dispatch_job = default_queue .enqueue (
492490 dispatch_conversation_complete_event_job ,
493491 conversation_id ,
494- audio_uuid ,
495492 client_id or "" ,
496493 user_id ,
497494 job_timeout = 120 , # 2 minutes
0 commit comments