Skip to content

Close discarded raw responses in high-level void methods#764

Open
fallintoplace wants to merge 1 commit into
openai:mainfrom
fallintoplace:fix/high-level-unit-close-responses
Open

Close discarded raw responses in high-level void methods#764
fallintoplace wants to merge 1 commit into
openai:mainfrom
fallintoplace:fix/high-level-unit-close-responses

Conversation

@fallintoplace

Copy link
Copy Markdown

Summary

  • explicitly close raw responses in high-level blocking void methods for container delete, response delete, container file delete, and realtime call accept/hangup/refer/reject
  • explicitly close raw responses in the matching async void methods instead of discarding them with empty thenAccept {} callbacks
  • add a focused unit test that verifies each affected blocking and async method closes a successful raw response exactly once

Why

These high-level methods delegate to raw-response methods that return lazily parsed parseable wrappers. For successful empty-body endpoints, discarding that wrapper without parsing or closing it can leave the underlying response open.

Validation

  • env JAVA_HOME=/opt/homebrew/opt/openjdk@21/libexec/openjdk.jdk/Contents/Home PATH=/opt/homebrew/opt/openjdk@21/libexec/openjdk.jdk/Contents/Home/bin:$PATH ./gradlew :openai-java-core:test --tests com.openai.services.HighLevelUnitMethodsCloseResponseTest
  • env JAVA_HOME=/opt/homebrew/opt/openjdk@21/libexec/openjdk.jdk/Contents/Home PATH=/opt/homebrew/opt/openjdk@21/libexec/openjdk.jdk/Contents/Home/bin:$PATH ./gradlew :openai-java-core:lintKotlin

Notes

  • The generated service integration tests for these endpoints use TestServerExtension and require the repo mock server (./scripts/mock), which was not running in this environment.

@fallintoplace fallintoplace requested a review from a team as a code owner June 27, 2026 20:31
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.

1 participant