Skip to content

fix: rename DEFER_PYDANTIC_BUILD to OPENAI_PYDANTIC_DEFER_BUILD - #3720

Open
SparshM8 wants to merge 3 commits into
openai:mainfrom
SparshM8:fix/pydantic-defer-build-env-var
Open

fix: rename DEFER_PYDANTIC_BUILD to OPENAI_PYDANTIC_DEFER_BUILD#3720
SparshM8 wants to merge 3 commits into
openai:mainfrom
SparshM8:fix/pydantic-defer-build-env-var

Conversation

@SparshM8

Copy link
Copy Markdown

This addresses issue #1306 by renaming the internal environment variable to be library-specific, avoiding potential conflicts with other Pydantic-based libraries. Also fixes a typo in coerce_boolean utility.

  • I understand that this repository is auto-generated and my pull request may not be merged

Changes being requested

Additional context & links

This addresses issue openai#1306 by renaming the internal environment variable to be library-specific, avoiding potential conflicts with other Pydantic-based libraries. Also fixes a typo in coerce_boolean utility.
@SparshM8
SparshM8 requested a review from a team as a code owner August 22, 2026 12:58

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0cdaa122e6

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/openai/_models.py Outdated
model_config: ClassVar[ConfigDict] = ConfigDict(
extra="allow", defer_build=coerce_boolean(os.environ.get("DEFER_PYDANTIC_BUILD", "true"))
extra="allow",
defer_build=coerce_boolean(os.environ.get("OPENAI_PYDANTIC_DEFER_BUILD", os.environ.get("DEFER_PYDANTIC_BUILD", "true"))),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Stop honoring the conflicting unscoped variable

When another Pydantic-based library sets only DEFER_PYDANTIC_BUILD—the collision this rename is intended to fix—this fallback still applies that foreign value to OpenAI's BaseModel, so the scoped rename does not isolate OpenAI unless users also define the new variable. Since the repository's test runner now sets the scoped name, remove the unscoped fallback (or otherwise constrain it to an explicit migration path) so unrelated environments cannot alter OpenAI model construction.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 87155fbdc5

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +89 to +95
def get_abort_reconciliation_items(self) -> List[Dict[str, Any]]:
"""Returns a list of synthetic function_call_output items for any pending tool calls.

This should be used if the stream is closed before it has been read to completion
to ensure that the conversation state remains consistent.
"""
return self._state.get_abort_reconciliation_items()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Remove the unrelated streaming API addition

This environment-variable rename also adds a public ResponseStream method plus substantial reconciliation state machinery that is unrelated to the stated fix and has no focused synchronous or asynchronous tests. Because ResponseStream is re-exported from openai.lib.streaming.responses, merging this commit would silently expand the supported SDK API with unvalidated semantics; move these _responses.py changes to the dedicated feature change instead.

AGENTS.md reference: AGENTS.md:L5-L8

Useful? React with 👍 / 👎.

Comment on lines +412 to +413
for output in snapshot.output:
if output.type == "function_call":

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Skip calls that already have an output

When a streamed response contains both a function_call and its corresponding function_call_output—both are valid ResponseOutputItem variants and the accumulator retains both—this loop still emits another synthetic output for that call ID. Passing the returned reconciliation list into the next request can therefore submit two outputs for an already-satisfied call; collect existing output call IDs and exclude them here.

Useful? React with 👍 / 👎.

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