Skip to content

fix: type response output text annotation events#3467

Open
nightcityblade wants to merge 2 commits into
openai:mainfrom
nightcityblade:fix/issue-3419
Open

fix: type response output text annotation events#3467
nightcityblade wants to merge 2 commits into
openai:mainfrom
nightcityblade:fix/issue-3419

Conversation

@nightcityblade

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

Changes being requested

Fixes #3419.

Use the existing Annotation discriminated union for ResponseOutputTextAnnotationAddedEvent.annotation instead of object, and add a regression test that validates URL citation payloads are parsed into the typed annotation model.

Additional context & links

Validation:

  • .venv/bin/python -m pytest -o addopts= tests/test_models.py -k response_output_text_annotation_added_event

@nightcityblade nightcityblade requested a review from a team as a code owner July 3, 2026 03:55

@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: c8e04a21f7

ℹ️ 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 tests/test_models.py Outdated


def test_response_output_text_annotation_added_event_uses_annotation_union() -> None:
event = ResponseOutputTextAnnotationAddedEvent.model_validate(

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 Use the pydantic-version-neutral parser

This new test is run in the repo's Pydantic v1 job (scripts/test invokes nox -s test-pydantic-v1, and noxfile.py installs pydantic<2), but model_validate only exists on Pydantic v2 models and this project only shims dump methods on its v1 BaseModel. Under the v1 test job this line raises AttributeError before exercising the regression; use the already imported _compat.parse_obj/model_parse helper or skip the test for PYDANTIC_V1.

Useful? React with 👍 / 👎.

@nightcityblade

Copy link
Copy Markdown
Author

Addressed in c5c6a36. The regression test now uses the version-neutral model_parse helper so it runs under both Pydantic v1 and v2 jobs.

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.

ResponseOutputTextAnnotationAddedEvent.annotation typed as object instead of Annotation

1 participant