Skip to content

fix(types): allow missing name on function_call_arguments.done events#3523

Open
Solaris-star wants to merge 1 commit into
openai:mainfrom
Solaris-star:fix/3472-optional-function-call-name
Open

fix(types): allow missing name on function_call_arguments.done events#3523
Solaris-star wants to merge 1 commit into
openai:mainfrom
Solaris-star:fix/3472-optional-function-call-name

Conversation

@Solaris-star

Copy link
Copy Markdown

Summary

  • Live Responses streaming can emit response.function_call_arguments.done without a name field.
  • The generated model required name: str, so strict ResponseStreamEvent union validation failed (missing: name) and typed access was misleading after lenient construction.
  • Make name optional on the responses + beta responses done events; keep present values working.
  • Add unit coverage for missing/present name and for union validation.

Fixes #3472

Test plan

  • pytest tests/test_response_function_call_arguments_done_event.py -o addopts=4 passed
  • CI full suite
  • Note: types are Stainless-generated; this hand-edit may need to land in the upstream OpenAPI/spec so future regenerations keep the optional field.

Live Responses API streaming may omit `name` on
`response.function_call_arguments.done` payloads. The generated model
required `name: str`, so strict ResponseStreamEvent union validation
failed (and typed access was misleading after lenient construct).

Make `name` optional on the responses / beta responses done events and
add unit coverage for missing and present values.

Fixes openai#3472
@Solaris-star
Solaris-star requested a review from a team as a code owner July 21, 2026 05:20

@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: 00c35d5800

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


def test_function_call_arguments_done_accepts_missing_name() -> None:
"""Live Responses API may omit `name` on done events (issue #3472)."""
event = ResponseFunctionCallArgumentsDoneEvent.model_validate(PAYLOAD_WITHOUT_NAME)

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 Pydantic-v1-compatible validation in tests

In the pydantic-v1 CI session (noxfile.py installs pydantic<2 and runs the full pytest suite), this new test file fails before exercising the fix: under Pydantic v1 these models do not expose model_validate, and the later union test also calls pydantic.TypeAdapter, which is v2-only. Using the repository's compatibility helpers (or otherwise gating the v2-only union assertion) keeps the tests passing for the supported pydantic>=1.9.0,<3 range.

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.

Responses streaming: response.function_call_arguments.done events lack the required 'name' field, failing strict event-union validation

1 participant