Skip to content

feat(api)!: give evolving union visitors default fallback methods - #1368

Merged
dpiet-oai merged 4 commits into
nextfrom
castiron/promotions/pr-439
Nov 10, 2026
Merged

dpiet-oai merged 4 commits into
nextfrom
castiron/promotions/pr-439

Conversation

@dpiet-oai

Copy link
Copy Markdown
Contributor

Summary

Java and Kotlin union visitors can override the variants they handle and send other variants to a fallback.

Changes

  • Override unknown(JsonValue) to handle JSON variants that have no specific override.
  • Override unknown(Object) in Java or unknown(Any?) in Kotlin to receive the original value for an unhandled binary variant. The fallback leaves streams open and unread.
  • If a class implements multiple visitor interfaces that supply the same default method, override that method on the class and recompile it.

Castiron-Internal-PR: openai/openai-java-internal#439
Castiron-Source-SHA: 49d6adb648242723921716971ce168dd9fd528c2
Castiron-Public-Base-SHA: 5d272f8
@dpiet-oai
dpiet-oai requested a review from a team as a code owner November 10, 2026 19:01
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-10T19:32:25.343865Z 9ae0186 New commits
🔒 Security Review ✅ Completed 2026-11-10T19:33:11.865674Z 9ae0186 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

jbeckwith-oai
jbeckwith-oai previously approved these changes Nov 10, 2026

@jbeckwith-oai jbeckwith-oai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved at 5adbe07. Verified all 328 changed files from the paginated file list match the previously approved private candidate at 49d6adb648242723921716971ce168dd9fd528c2, including all 320 generated model files, binary fallback, tests, migration documentation and inventory. Rechecked the public build’s JVM-default configuration and the visitor behavior: typed overrides retain precedence, JSON fallbacks receive JsonValue, binary fallbacks preserve original unread/unclosed values, and default-method conflicts/recompilation requirements are documented. No blocking findings.

Static review only; no candidate code or tests run locally. Hosted CI is still running.

@dpiet-oai

Copy link
Copy Markdown
Contributor Author

Please review the fixture change. The large-selection case prepares 51 destinations and serializes the full first upload before the transport returns HTTP 503. Its five-second wait expired in public CI. Only this case now waits up to 30 seconds.

Kotlin lint and all 39 agent-file tests passed on the base and candidate with both Jackson configurations. On both trees, changing only the transport response to HTTP 400 made the existing cause assertion fail with BadRequestException. The committed fixture keeps the 50 MiB + 1 byte sparse input, HTTP 503, both exception checks, and the one-upload assertion.

jbeckwith-oai
jbeckwith-oai previously approved these changes Nov 10, 2026

@jbeckwith-oai jbeckwith-oai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed the incremental change: only the large upload serialization regression gets a 30-second future wait. Every other helper caller retains the five-second default; exception unwrapping, client cleanup, and all error/upload-count assertions are unchanged. The previously reviewed visitor implementation is unchanged. No actionable findings. Fresh hosted CI is running. Static review only; no local code/tests executed.

@dpiet-oai

Copy link
Copy Markdown
Contributor Author

The timer fixture commit runs both scheduled callbacks on the existing per-instance test clock before draining the caller executor. It removes the 550 ms sleep and preserves all seven assertions, including the final transcript, inactivity close reason, and callback coalescing.

I reran the focused test and the full 39-test transcript grouper class on the merged base and the candidate with both Jackson configurations. All four focused runs and all 156 complete-class executions passed. The two commits after the reviewed visitor change touch only the transcript timer and large agent-file test fixtures.

jbeckwith-oai
jbeckwith-oai previously approved these changes Nov 10, 2026

@jbeckwith-oai jbeckwith-oai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the timer-fixture increment after the prior approval. ManualTime explicitly fires the initial delivery timer and subsequent inactivity timer while the caller executor remains queued. The production scheduler path and all seven coalescing/finalization assertions are preserved. No actionable findings. Fresh hosted CI is pending. Static review only; no candidate code or tests executed.

@dpiet-oai

Copy link
Copy Markdown
Contributor Author

The one-line fixture change gives the asynchronous directory, prepare, and upload operations 30 seconds to finish. The thread-local filesystem guard and exactly-one-upload assertion are unchanged.

A six-second delay in the upload transport reproduced the original five-second timeout. With the new bound the same upload passed. All 39 agent-file tests passed on both the base and the visitor candidate under both Jackson configurations. In a negative control, all three real synchronous overloads triggered the expected caller-thread assertion on both trees and configurations.

@jbeckwith-oai jbeckwith-oai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed the exact change since my prior approval: the asynchronous file-helper test now allows 30 seconds for completion instead of 5. The thread-local Files.readAttributes guard remains active across invocation and completion, and all three parameter cases plus the upload-count assertion remain intact. This preserves the caller-thread isolation check while relaxing its completion deadline. No production code changed and no actionable findings.

Hosted CI is still running. This static review does not establish the cause of the earlier timeout or claim that the new run passes. No candidate code or local tests were run.

@dpiet-oai
dpiet-oai merged commit 4a41191 into next Nov 10, 2026
14 checks passed
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.

2 participants