Skip to content

Swift Realtime: conversation.item.input_audio_transcription.failed is silently dropped #641

Description

@cornelcroi

Problem

RealtimeWire.decode only handles .delta and .completed for input_audio_transcription events. When the API emits conversation.item.input_audio_transcription.failed (e.g. the transcription model is not allowed on the token's OpenAI project → per-request model_not_found), the event is dropped on the floor.

Consequences in a voice session:

  1. No .userTranscript(_, final: true) is ever emitted for the turn — the consumer's pending user bubble never resolves, so the user's speech is invisible in the UI.
  2. userText stays empty — the turn span's input is never set, so traces (LangSmith) show assistant replies with no user input.
  3. Consumers that persist history guarded on a non-empty user text drop the whole exchange.

The failure is deliberately outside the error event stream on the API side (transcription is an async side-channel; the model hears the raw audio natively and the conversation continues fine), so nothing else surfaces it either. Found in production use: a project-allowlist restriction on gpt-4o-transcribe made every user turn silently transcript-less.

Fix (prepared, PR follows)

  • RealtimeWire: decode .failed → new ServerEvent.userTranscriptFailed(code:message:).
  • OpenAIVoiceAssistant: on .userTranscriptFailed, emit .userTranscript("", final: true) to close the turn's user-bubble state, and stamp the cause on the turn span metadata (input_transcription_error) — not the session error path, which would trigger recovery for a non-fatal condition.
  • OpenAIGroundedVoiceAssistant: same empty-final emit.

Three files, 424 tests passing.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions