Skip to content

fix(realtime): preserve server status on converted message items#3568

Open
code-with-rashid wants to merge 1 commit into
openai:mainfrom
code-with-rashid:fix/realtime-message-status
Open

fix(realtime): preserve server status on converted message items#3568
code-with-rashid wants to merge 1 commit into
openai:mainfrom
code-with-rashid:fix/realtime-message-status

Conversation

@code-with-rashid
Copy link
Copy Markdown

Summary

_ConversionHelper.conversation_item_to_realtime_message_item hardcoded "status": "in_progress" for every converted message. This path handles conversation.item.added / created / retrieved events, so an assistant message the server had already marked completed still surfaced as in_progress in history_updated events — even after the assistant finished speaking or generating audio.

The incoming ConversationItem already carries a status (completed / incomplete / in_progress). This change mirrors that status onto the converted RealtimeMessageItem and falls back to "in_progress" only when the server omits one. The sibling response.output_item.* path already derives status this way, so this also makes the two conversion paths consistent.

Test plan

  • Added test_message_conversion_preserves_server_status (server completed → converted completed) and test_message_conversion_defaults_status_when_missing (no server status → in_progress) in tests/realtime/test_item_parsing.py.
  • uv run pytest tests/realtime/ — 257 passed.
  • make lint, make format, and mypy on the changed file pass clean.

Issue number

Closes #1434

Checks

  • I've added new tests (if relevant)
  • I've added/updated the relevant documentation
  • I've run make lint and make format
  • I've made sure tests pass

conversation_item_to_realtime_message_item hardcoded "in_progress" for
every converted message, so assistant messages the server had already
marked "completed" still surfaced as in_progress in history_updated
events. Mirror the status reported on the incoming ConversationItem and
fall back to "in_progress" only when the server omits it.

Fixes openai#1434
@seratch seratch added duplicate This issue or pull request already exists feature:realtime labels Jun 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

duplicate This issue or pull request already exists feature:realtime

Projects

None yet

Development

Successfully merging this pull request may close these issues.

in history_updated events, the status of 'assistant' is always 'in_progress'. After the assistant has spoken or generated audio, it must say 'Completed'

2 participants