Skip to content

Allow superseded audio replies to be aborted #34

Description

@cubrift

Problem

The audio response path creates an AbortController and uses it for transcription, but the subsequent openai.chat.completions.create call that generates the TTS response does not receive the controller signal.

When a new message arrives for the same chat, Quart aborts the active controller, but an in-flight audio generation can continue and send stale audio after the newer message has started processing.

Expected behavior

Audio transcription and audio response generation should both stop when their controller is aborted.

Suggested direction

Pass the controller signal using the OpenAI request options supported by the current client, and check the signal before sending the generated audio.

Acceptance criteria

  • A superseded TTS request receives the active abort signal.
  • Aborted audio generation does not send stale audio.
  • Presence is returned to paused after cancellation.
  • Normal audio replies still send exactly one audio message.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcodexUse for codex-generated issues only.good first issueGood for newcomers

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions