Skip to content

fix(openai): skip realtime truncate when no audio was played fixes : #6157#6158

Open
ByteMaster-1 wants to merge 2 commits into
livekit:mainfrom
ByteMaster-1:fix/realtime-truncate-zero-length-audio
Open

fix(openai): skip realtime truncate when no audio was played fixes : #6157#6158
ByteMaster-1 wants to merge 2 commits into
livekit:mainfrom
ByteMaster-1:fix/realtime-truncate-zero-length-audio

Conversation

@ByteMaster-1

@ByteMaster-1 ByteMaster-1 commented Jun 18, 2026

Copy link
Copy Markdown

Fixes #6157

Skip the realtime conversation.item.truncate when the generation is
interrupted before any audio frame has played (audio_end_ms == 0), which
the Realtime API rejects with unsupported_content_type
("Only model output audio messages can be truncated").

@ByteMaster-1 ByteMaster-1 requested a review from a team as a code owner June 18, 2026 17:16
@CLAassistant

CLAassistant commented Jun 18, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@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

@ByteMaster-1 ByteMaster-1 force-pushed the fix/realtime-truncate-zero-length-audio branch from 0de3d9f to 9fa9693 Compare June 18, 2026 17:41
Address review (longcw): when audio_end_ms == 0 the server may hold a
generated-but-unheard audio item (case 2). Delete it so the remote chat
ctx matches the local one, guarded on the item actually existing remotely
so we don't surface a delete error for the never-committed case (case 1).

@longcw longcw 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.

looks good to me, something nit:

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.

RealtimeModel: "Only model output audio messages can be truncated" when interrupted before first audio frame

4 participants