async def test_interruption_handling(self):
        """Test that messages are properly captured when bot is interrupted"""
        processor = AssistantTranscriptProcessor()

        # Track received updates
        received_updates: List[TranscriptionUpdateFrame] = []

        @processor.event_handler("on_transcript_update")
        async def handle_update(proc, frame: TranscriptionUpdateFrame):
            received_updates.append(frame)

        # Simulate bot being interrupted mid-sentence
        frames_to_send = [
            BotStartedSpeakingFrame(),
            SleepFrame(sleep=0.1),
            TTSTextFrame(text="Hello"),
            TTSTextFrame(text="world!"),
            SleepFrame(sleep=0.1),
            StartInterruptionFrame(),  # User interrupts here
            SleepFrame(sleep=0.1),
            BotStartedSpeakingFrame(),
            TTSTextFrame(text="New"),
            TTSTextFrame(text="response"),
            SleepFrame(sleep=0.1),
            BotStoppedSpeakingFrame(),
        ]

        # Actual order of frames:
        expected_down_frames = [
            BotStartedSpeakingFrame,
            TTSTextFrame,  # "Hello"
            TTSTextFrame,  # "world!"
            StartInterruptionFrame,
            TranscriptionUpdateFrame,  # First message (emitted due to interruption)
            BotStartedSpeakingFrame,
            TTSTextFrame,  # "New"
            TTSTextFrame,  # "response"
            BotStoppedSpeakingFrame,
            TranscriptionUpdateFrame,  # Second message
        ]

        # Run test
        received_frames, _ = await run_test(
            processor,
            frames_to_send=frames_to_send,
            expected_down_frames=expected_down_frames,
        )

        # Should have received two updates
        self.assertEqual(len(received_updates), 2)

        # First update should be interrupted message
        first_message = received_updates[0].messages[0]
        self.assertEqual(first_message.role, "assistant")
        self.assertEqual(first_message.content, "Hello world!")
        self.assertIsNotNone(first_message.timestamp)

        # Second update should be new response
        second_message = received_updates[1].messages[0]
        self.assertEqual(second_message.role, "assistant")
        self.assertEqual(second_message.content, "New response")
        self.assertIsNotNone(second_message.timestamp)

        # Verify timestamps are different
        self.assertNotEqual(first_message.timestamp, second_message.timestamp)
Test that messages are properly captured when bot is interrupted
tests/test_transcript_processor.py