Skip to content

Conversation

@aconchillo
Copy link
Contributor

@aconchillo aconchillo commented Dec 4, 2025

Please describe the changes in your PR. If it is addressing an issue, please reference that as well.

In this PR we introduce the UninterruptibleFrame mixin. This mixin is used to mark certain data and control frames as uninterruptible. Sometimes we need to use ordered frames (data and control) but we don't want those frames to be discarded or cancelled if there's an interruption, this is what this new frame type is useful for.

@dataclass
class TestFrame(DataFrame, UninterruptibleFrame):
   data: str

We also change the behavior of FunctionCallInProgressFrame and FunctionCallResultFrame, bot have now changed from system frames to control and data frames, respectively. Both are set to UninterruptibleFrame.

@codecov
Copy link

codecov bot commented Dec 4, 2025

Codecov Report

❌ Patch coverage is 84.61538% with 6 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/pipecat/processors/frame_processor.py 66.66% 6 Missing ⚠️
Files with missing lines Coverage Δ
src/pipecat/frames/frames.py 86.37% <100.00%> (+0.07%) ⬆️
src/pipecat/processors/frame_processor.py 83.50% <66.66%> (-0.51%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@aconchillo aconchillo force-pushed the aleix/introduce-uninterruptible-frames branch from 03d4705 to 87668e5 Compare December 4, 2025 23:03
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we also change FunctionCallsStartedFrame and FunctionCallCancelFrame? Otherwise, it feels like a race condition could happen.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the case of FunctionCallsStartedFrame we might want to notify right away that function calls are about to start . For FunctionCallCancelFrame it doesn't really matter. These two don't modify the context and don't trigger any inference. So, I didn't see a reason to change them.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I was wondering if we might have a race condition, but I think we’re okay. 👍

@kompfner
Copy link
Contributor

kompfner commented Dec 5, 2025

Tested the changes in this PR against the problem scenario described in #3175 and it resolves it!

@aconchillo aconchillo force-pushed the aleix/introduce-uninterruptible-frames branch from 87668e5 to 49b2b12 Compare December 5, 2025 17:22
Comment on lines +924 to +928
# Put back UninterruptibleFrame frames into our process queue.
while not new_queue.empty():
item = new_queue.get_nowait()
self.__process_queue.put_nowait(item)
new_queue.task_done()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn’t it be enough to simply do self.__process_queue = new_queue here ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, because the process task is using the old queue still and we are not cancelling the task.

# interruption). Instead we just drain the queue because this is
# an interruption.
self.__reset_process_task()
elif isinstance(self.__process_current_frame, UninterruptibleFrame):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. 👍

Copy link
Contributor

@filipi87 filipi87 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Nice improvement. Thank you for doing this. 🚀

@aconchillo aconchillo merged commit 92b6e8d into main Dec 7, 2025
6 checks passed
@aconchillo aconchillo deleted the aleix/introduce-uninterruptible-frames branch December 7, 2025 22:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants