Skip to content

[codex] fix Responses SSE content part lifecycle for streaming fallback#2880

Open
jerryan999 wants to merge 1 commit into
Wei-Shaw:mainfrom
jerryan999:codex/fix-responses-content-part-events
Open

[codex] fix Responses SSE content part lifecycle for streaming fallback#2880
jerryan999 wants to merge 1 commit into
Wei-Shaw:mainfrom
jerryan999:codex/fix-responses-content-part-events

Conversation

@jerryan999
Copy link
Copy Markdown

Summary

  • emit response.content_part.added before the first response.output_text.delta for streamed text message items
  • emit response.content_part.done after response.output_text.done with the final accumulated text
  • cover both chat-completions-to-responses and anthropic-to-responses bridges with regression tests

Root Cause

The Responses streaming bridges created response.output_item.added and then streamed response.output_text.delta directly, but never opened or closed the active text content part. Clients that enforce the Responses event model, including Codex CLI, therefore rejected text deltas because no active content part existed.

Validation

  • go test ./internal/pkg/apicompat
  • go test -tags unit ./internal/service -run 'TestForwardResponses_ForceChatCompletionsRoutesStreamingToChatCompletions$'

Fixes #2875

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 29, 2026

All contributors have signed the CLA. ✅
Posted by the CLA Assistant Lite bot.

@jerryan999
Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

github-actions Bot added a commit that referenced this pull request May 29, 2026
@jerryan999 jerryan999 marked this pull request as ready for review May 29, 2026 05:52
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.

Missing 'response.content_part.added' SSE event in Responses API streaming - breaks Codex CLI compatibility

1 participant