Skip to content

Handle null response output_text items#3062

Open
texasich wants to merge 4 commits intoopenai:mainfrom
texasich:main
Open

Handle null response output_text items#3062
texasich wants to merge 4 commits intoopenai:mainfrom
texasich:main

Conversation

@texasich
Copy link
Copy Markdown

@texasich texasich commented Apr 6, 2026

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

Changes being requested

  • allow ResponseOutputText.text to be nullable during response parsing
  • skip null output_text items in Response.output_text
  • add a regression test covering a response payload with one null text item and one normal text item

Additional context & links

This addresses issue #3011, where accessing Response.output_text can fail when an output_text content item contains text: null.

Verification:

  • ran tests/lib/responses/test_responses.py
  • all tests in that file passed locally

texasich and others added 2 commits April 5, 2026 22:00
## Summary
Fix handling of `response.output_text` items when the API returns `text: null`.

## Changes
- allow `ResponseOutputText.text` to be nullable during response parsing
- skip null `output_text` items in `Response.output_text`
- add a regression test covering a response payload with one null text item and one normal text item

## Verification
- ran `tests/lib/responses/test_responses.py`
- all tests in that file passed locally

## Context
Addresses issue openai#3011, where accessing `Response.output_text` can fail when an `output_text` content item contains `text: null`.
@texasich texasich requested a review from a team as a code owner April 6, 2026 03:11
Copy link
Copy Markdown

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

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: 6dc33f03d5

ℹ️ 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".

@texasich
Copy link
Copy Markdown
Author

texasich commented Apr 6, 2026

Opened a tracking issue for the bug here: #3063

I also pushed a follow-up fix for the structured parsing path so responses.parse(...) skips null output_text items as well.

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