Skip to content

fix(openai realtime): do not commit a turn the server closed itself - #6965

Open
longcw wants to merge 1 commit into
mainfrom
longc/openai-rt-double-commit
Open

fix(openai realtime): do not commit a turn the server closed itself#6965
longcw wants to merge 1 commit into
mainfrom
longc/openai-rt-double-commit

Conversation

@longcw

@longcw longcw commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Problem

With server-side turn detection, the server commits each segment that it detects. The framework still calls commit_audio() on every client turn.

Each turn then asks the server to close a buffer that it already emptied, and the server answers with input_audio_buffer_commit_empty. #6642 suppressed that error and left the commit in place.

create_response=False makes this fire on every single turn: the client owns the reply, so it commits and asks for a response, while the server keeps segmenting the audio on its own.

Fix

The session now handles input_audio_buffer.committed and clears the count of pushed audio. commit_audio() then has nothing to send, and its own meaning does not change.

Only a segment that the server closed itself counts. A client commit is acknowledged with the same event, and audio that arrived while that commit was in flight is still the client's to commit.

The error suppression stays. A client commit and the server's own can still cross on the wire, and nothing on the client can prevent that.

With server-side turn detection the server commits each segment it
detects, but the framework still called commit_audio() on every client
turn. Each turn asked the server to close a buffer it had already
emptied and logged input_audio_buffer_commit_empty, which #6642
suppressed instead of removing the commit. create_response=False makes
this fire on every turn, because the client owns the reply while the
server keeps segmenting.

The session now tracks the server's own commits and clears the count of
pushed audio, so commit_audio() has nothing left to send and keeps its
meaning. Only a segment the server closed itself counts: a client
commit is acknowledged with the same event, and the audio that arrived
while it was in flight is still the client's to commit. The
suppression stays for the race where the two commits cross on the wire.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

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.

1 participant