Skip to content

fix(responses): emit message phase before text deltas - #8463

Open
Epsilon006 wants to merge 4 commits into
livekit:mainfrom
Epsilon006:fix/responses-message-phase-8427
Open

Epsilon006 wants to merge 4 commits into
livekit:mainfrom
Epsilon006:fix/responses-message-phase-8427

Conversation

@Epsilon006

@Epsilon006 Epsilon006 commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #8427. The OpenAI Responses plugin can deliver an assistant output message's phase before its first text delta when the provider supplies it at item start. The default remains completion-only on both HTTP and WebSocket.

llm = openai.responses.LLM(emit_phase_on_item_start=True)

With early delivery enabled:

  • Phase notifications and text chunks expose the item's ID and any known phase in delta.extra["openai_item"]. Use the response and item IDs to associate late updates with previously streamed text.
  • Repeated phase values for the same item produce one notification. A phase first supplied or changed at completion is emitted then. Text with an unknown phase streams immediately.
  • Phase notifications also set delta.extra["openai"]["phase"] for chat history. Keeping per-item metadata separate preserves the last reported phase when a later item has no phase.

Related to #8429, which also proposes opt-in early phase delivery.

Verification

  • 168 focused OpenAI and LiveKit Inference Responses tests passed. Four new cases reproduced the phase loss on the previous revision and now pass, covering LLMStream.collect() and voice aggregation over HTTP and WebSocket, including follow-up Responses formatting.
  • Repository-wide Ruff lint and formatting, targeted mypy, and git diff --check passed.
  • The Windows test harness stubbed the unused native audio-inference import and fails if a test calls it.

@Epsilon006
Epsilon006 requested a review from a team as a code owner November 9, 2026 14:11
devin-ai-integration[bot]

This comment was marked as resolved.

@CLAassistant

CLAassistant commented Nov 9, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

devin-ai-integration[bot]

This comment was marked as resolved.

@Epsilon006
Epsilon006 force-pushed the fix/responses-message-phase-8427 branch from 108d6fe to 0900058 Compare November 9, 2026 14:35

This branch has not been deployed

No deployments
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.

OpenAI Responses API: publish the output message phase at response.output_item.added

2 participants