You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: prevent mark metadata leak in Twilio buffering (addresses Codex P1)
Critical fix for memory leak identified by chatgpt-codex-connector:
Problem:
- Each audio chunk created a mark entry in _mark_data
- But only the last mark_id was sent to Twilio when flushing buffer
- Earlier marks were never acknowledged, causing memory leak
- Playback tracker couldn't track all sent audio
Solution:
- Track all mark_ids for buffered chunks in _buffered_marks list
- Send mark events for ALL buffered chunks when flushing
- Clear _buffered_marks after flush to prevent reuse
- Extract mark creation logic to _create_mark() method (addresses Copilot nitpick)
Additional improvements:
- Remove '- NEW' comment suffix (Copilot suggestion)
- _flush_outgoing_audio_buffer now handles empty buffer check internally
This ensures proper playback tracking and prevents _mark_data from growing indefinitely.
Generated with Lucas Wang<[email protected]>
Co-Authored-By: Claude <[email protected]>
0 commit comments