Skip to content

Emit standard Realtime output-item and content-part lifecycle events #457

Description

@andimarafioti

Problem

The Realtime endpoint emits response deltas, per-modality done events, and response.done, but omits the standard per-item lifecycle events:

  • response.output_item.added
  • response.content_part.added
  • response.content_part.done
  • response.output_item.done

The official Realtime text lifecycle places these events around response.output_text.delta / response.output_text.done and before response.done. The response.output_item.done reference also specifies that it is emitted when a response is interrupted, incomplete, or cancelled.

This omission predates #453. Ordered multi-item responses make it more visible because a client waiting for item completion only discovers the final items inside response.done.

Expected behavior

Emit the standard lifecycle for every assistant message or function-call output item while preserving the stable item IDs and response-wide output_index values already used by the endpoint.

Acceptance criteria

  • Emit response.output_item.added when each response output item begins.
  • Emit response.content_part.added before streaming a message content part and response.content_part.done after its modality-specific done event.
  • Emit response.output_item.done after every item completes, including items exposed before interruption, incomplete completion, or cancellation.
  • Emit response.done only after all applicable item/content lifecycle events.
  • Keep IDs and output indexes consistent across lifecycle events and response.done.output.
  • Add WebSocket and WebRTC protocol-sequence contract tests covering text, text → tool → text, and cancellation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions