From 7372f80530bd8bc85b72089d2f2a3f68f5b04b66 Mon Sep 17 00:00:00 2001 From: Sergey Mankovsky Date: Wed, 11 Feb 2026 19:29:29 +0100 Subject: [PATCH] Allow reprocessing idle multitrack transcripts --- .../reflector/services/transcript_process.py | 7 ++++-- server/tests/test_hatchet_dispatch.py | 25 ++++++++++++++++++- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/server/reflector/services/transcript_process.py b/server/reflector/services/transcript_process.py index 13847a49..fb36cfeb 100644 --- a/server/reflector/services/transcript_process.py +++ b/server/reflector/services/transcript_process.py @@ -97,8 +97,11 @@ async def validate_transcript_for_processing( if transcript.locked: return ValidationLocked(detail="Recording is locked") - # Check if recording is ready for processing - if transcript.status == "idle" and not transcript.workflow_run_id: + if ( + transcript.status == "idle" + and not transcript.workflow_run_id + and not transcript.recording_id + ): return ValidationNotReady(detail="Recording is not ready for processing") # Check Celery tasks diff --git a/server/tests/test_hatchet_dispatch.py b/server/tests/test_hatchet_dispatch.py index 157f2b5c..390b8e81 100644 --- a/server/tests/test_hatchet_dispatch.py +++ b/server/tests/test_hatchet_dispatch.py @@ -255,7 +255,7 @@ async def test_validation_locked_transcript(): @pytest.mark.usefixtures("setup_database") @pytest.mark.asyncio async def test_validation_idle_transcript(): - """Test that validation rejects idle transcripts (not ready).""" + """Test that validation rejects idle transcripts without recording (file upload not ready).""" from reflector.services.transcript_process import ( ValidationNotReady, validate_transcript_for_processing, @@ -274,6 +274,29 @@ async def test_validation_idle_transcript(): assert "not ready" in result.detail.lower() +@pytest.mark.usefixtures("setup_database") +@pytest.mark.asyncio +async def test_validation_idle_transcript_with_recording_allowed(): + """Test that validation allows idle transcripts with recording_id (multitrack ready/retry).""" + from reflector.services.transcript_process import ( + ValidationOk, + validate_transcript_for_processing, + ) + + mock_transcript = Transcript( + id="test-transcript-id", + name="Test", + status="idle", + source_kind="room", + recording_id="test-recording-id", + ) + + result = await validate_transcript_for_processing(mock_transcript) + + assert isinstance(result, ValidationOk) + assert result.recording_id == "test-recording-id" + + @pytest.mark.usefixtures("setup_database") @pytest.mark.asyncio async def test_prepare_multitrack_config():