feat(api): Ultrafast tier, structured MCP and websocket errors, separate websocket events - #863
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dc4f09a5ac
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| private val responseContentPartDone: ResponseContentPartDoneEvent? = null, | ||
| private val responseCreated: ResponseCreatedEvent? = null, | ||
| private val error: ResponseErrorEvent? = null, | ||
| private val error: ResponseWsError? = null, |
There was a problem hiding this comment.
Read the typed stream ID from WebSocket errors
When an error event is constructed with ResponseWsError.builder().streamId(...) and wrapped using ResponsesServerEvent.ofError, the outer streamId() accessor returns empty because streamIdField() still searches error._additionalProperties() rather than the new typed stream-ID field. Deserialized events appear correct only because _json supplies the value. Update the error branch, and the equivalent beta branch, to read the typed field.
Useful? React with 👍 / 👎.
| val bestMatches = | ||
| sequenceOf( | ||
| tryDeserialize(node, jacksonTypeRef<McpProtocolError>())?.let { |
There was a problem hiding this comment.
Preserve unknown structured MCP errors
When the API returns a future structured MCP error with an unrecognized type, each object deserializer here still succeeds because unknown fields and discriminator values are retained, so bestMatches selects an invalid known variant (usually McpProtocolError) instead of the union's unknown variant. Consequently accept dispatches to the wrong visitor and validate() throws, despite the documented forward-compatible unknown path. Dispatch recognized object types by their discriminator and preserve unrecognized types as _json; the same generated MCP error union is duplicated in the other response item models.
Useful? React with 👍 / 👎.
jbeckwith-oai
left a comment
There was a problem hiding this comment.
I found two blocking issues at exact head dc4f09a5ac9c1e080ea92e9b54f0782444f99878:
-
[High] Preserve the existing MCP error getter API. In
ResponseInputItem.kt:14279(and the corresponding stable, beta, output, and conversation models),error()changes fromOptional<String>toOptional<Error>. Existing source callers no longer compile even though a string remains a supported wire variant. Please retain a deprecatederror(): Optional<String>that projects the string variant and add a separate structured accessor such aserrorUnion(), while keeping builder overloads for both; otherwise defer the replacement to a major release. -
[Medium] Reuse the named generated unions instead of embedding thousands of lines per owner. The same MCP error union is emitted as roughly 987 lines in each of seven model owners, while the annotation-added event grows from 434 to 2,073 lines (representative
ResponseOutputTextAnnotationAddedEvent.kt:457). The transformed schema already namesAnnotationandMCPToolCallError, so the Java generator should preserve/reuse that identity and introduce one named outer string-or-MCP-error union rather than duplicating full builders and serializers in every owner. Please add one canonical round-trip suite covering the legacy string plus all structured MCP variants; the changed owner tests currently exercise only the string case.
The remaining generated schema updates look internally consistent.
…ate websocket events Castiron-Internal-PR: openai/openai-java-internal#22 Castiron-Source-SHA: aad4f8fe638f7f0430637578c874b1dc1d9cf28d Castiron-Public-Base-SHA: 73b39b8
dc4f09a to
73a04d7
Compare
Automated Release PR --- ## [4.51.0](v4.50.0...v4.51.0) (2026-08-14) ### Features * **api:** Add GPT_DAYBREAK and GPT_5_6_CYBER model identifiers ([5b9ba3a](5b9ba3a)) * **api:** add WebSocket stream IDs ([#861](#861)) ([4936d0b](4936d0b)) * **api:** add workload identity access token issued event ([#859](#859)) ([2b763fe](2b763fe)) * **api:** deprecate Sora video APIs ([#860](#860)) ([a191575](a191575)) * **api:** Ultrafast tier, structured MCP and websocket errors, separate websocket events ([#863](#863)) ([ec274a8](ec274a8)) ### Bug Fixes * **api:** Add GPT_DAYBREAK and GPT_5_6_CYBER model identifiers ([#856](#856)) ([5b9ba3a](5b9ba3a)) * **api:** clarify audio upload metadata requirements ([#857](#857)) ([593f04c](593f04c)) * restore ProGuard configuration caching ([#842](#842)) ([fb8daa4](fb8daa4)) ### Chores * **api:** Update generated file header text ([#846](#846)) ([d11a357](d11a357)) * remove Stainless attribution and infrastructure ([#858](#858)) ([942a097](942a097)) ### Documentation * **api:** describe response stream event unions ([#862](#862)) ([73b39b8](73b39b8)) * keep README badges on latest release ([#839](#839)) ([33c6b57](33c6b57)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: openai-sdks[bot] <284451331+openai-sdks[bot]@users.noreply.github.com>
Summary
ultrafastResponses service tier, and optional model shutdown dates.