Skip to content

fix(types): make id and status optional in ResponseOutputMessageParam - #3584

Open
weed33834 wants to merge 1 commit into
openai:mainfrom
weed33834:fix/optional-id-status-output-message-param
Open

fix(types): make id and status optional in ResponseOutputMessageParam#3584
weed33834 wants to merge 1 commit into
openai:mainfrom
weed33834:fix/optional-id-status-output-message-param

Conversation

@weed33834

Copy link
Copy Markdown

Summary

When sending a client-authored assistant message via the Responses API (e.g. replayed from storage, edited, or produced by other code), the caller has no OpenAI message id or status. Previously the type system required both fields, forcing developers to fabricate fake values or use # type: ignore.

This is inconsistent with other input item types in the same union (ComputerCallOutput, FunctionCallOutput, ShellCall, etc.) which already use Optional[str] for id and Optional[Literal[...]] for status.

Changes

  • ResponseOutputMessageParam: id: Required[str]id: Optional[str], status: Required[...]status: Optional[...]
  • BetaResponseOutputMessageParam: same change
  • Updated docstrings to clarify these fields are populated when items are returned via API

Why

The id field is particularly problematic — fabricating a fake id could plausibly interfere with prompt caching, and there is no correct value to use when the message was never produced by the API.

The status field is also API-generated and meaningless for client-authored messages.

Both fields are already optional in the runtime behavior (the API accepts messages without them), so this fix aligns the type annotations with reality.

Fixes #3544

Verification

  • pyright passes with 0 errors on both modified files
  • Runtime tests confirm both with id/status and without id/status constructions work correctly
  • Existing Required fields (content, role, type) remain unchanged

When sending a client-authored assistant message via the Responses API
(e.g. replayed from storage, edited, or produced by other code), the
caller has no OpenAI message id or status. Previously the type system
required both fields, forcing developers to fabricate fake values or
use `# type: ignore`.

This change makes `id` and `status` Optional in both
`ResponseOutputMessageParam` and `BetaResponseOutputMessageParam`,
consistent with other input item types (e.g. `ComputerCallOutput`,
`FunctionCallOutput`, `ShellCall`) which already use `Optional[str]`
for these fields.

Fixes openai#3544
@weed33834
weed33834 requested a review from a team as a code owner August 8, 2026 00:16
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 API: sending a client-authored assistant turn requires either a fake message id or a # type: ignore

1 participant