---
type: email
from: gn00295120 <notifications@github.com>
subject: Re: [openai/openai-agents-python] fix: Twilio audio jittering by

 buffering outgoing audio chunks (PR #1926)
received: 2026-03-06 08:08:17
date_header: Sat, 18 Oct 2025 11:27:51 -0700
priority: normal
status: awaiting_approval
uid: 32935
---

## Email Content

**From:** gn00295120 <notifications@github.com>
**Subject:** Re: [openai/openai-agents-python] fix: Twilio audio jittering by

 buffering outgoing audio chunks (PR #1926)
**Date:** Sat, 18 Oct 2025 11:27:51 -0700

### Body (preview)

gn00295120 left a comment (openai/openai-agents-python#1926)



Thank you for the comprehensive review! All feedback has been addressed in commit ecf2c57:



## Critical Fix (Codex P1) ✅



**Fixed mark metadata memory leak**: You identified a serious bug! The problem was:



1. Each audio chunk created a mark entry in `_mark_data`

2. But only the **last** mark_id was sent when flushing the buffer

3. Earlier marks were never acknowledged by Twilio → memory leak

4. Playback tracker couldn't track all sent audio



**Solution implemented**:

- Added `_buffered_marks` list to track ALL mark_ids for chunks in current buffer

- Send mark events for **all** buffered chunks when flushing (lines 272-281)

- Clear `_buffered_marks` after each flush to prevent reuse

- Now all marks are properly acknowledged and cleaned up from `_mark_data`



## Copilot Suggestions ✅



1. **Removed '- NEW' suffix** from comment (line 60) ✅

2. **Extracted mark counter logic** to `_create_mark()` method (lines 246-251) - improves separation of concerns ✅

3. **Empty buffer handling** - `_flush_outgoing_audio_buffer()` now handles empty check internally (line 255), eliminating all the `if self._outgoing_audio_buffer:` checks throughout the code ✅



The fix ensures proper playback tracking and prevents `_mark_data` from growing indefinitely during long calls. All lint checks pass!



-- 

Reply to this email directly or view it on GitHub:

https://github.com/openai/openai-agents-python/pull/1926#issuecomment-3418725252

You are receiving this because you are subscribed to this thread.



Message ID: <openai/openai-agents-python/pull/1926/c3418725252@github.com>

---

## Suggested Actions
- [ ] Reply
- [ ] Archive
- [ ] Escalate
