Skip to content

fix: allow assistant messages in Responses input types - #3722

Open
medisean wants to merge 1 commit into
openai:mainfrom
medisean:codex/fix-response-assistant-input
Open

fix: allow assistant messages in Responses input types#3722
medisean wants to merge 1 commit into
openai:mainfrom
medisean:codex/fix-response-assistant-input

Conversation

@medisean

Copy link
Copy Markdown

Closes #3544

The Responses API accepts client-authored assistant turns without an id or status, but the generated ResponseInputItemParam type rejected the assistant role. This updates the generated type and OpenAPI schema enum so valid assistant input messages are accepted.

Validation:

  • python3 -m compileall -q src
  • `git diff --check

@medisean
medisean marked this pull request as ready for review August 23, 2026 08:46
@medisean
medisean requested a review from a team as a code owner August 23, 2026 08:46

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

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


role: Required[Literal["user", "system", "developer"]]
"""The role of the message input. One of `user`, `system`, or `developer`."""
role: Required[Literal["user", "assistant", "system", "developer"]]

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 Update all request input aliases

This updates only the standalone ResponseInputItemParam duplicate. Responses.create accepts the separately generated ResponseInputParam, whose Message.role still excludes assistant; consequently, a valid assistant message carrying the optional status field cannot match either that Message or EasyInputMessageParam and is rejected by type checkers. The beta schema was also changed, but both beta request aliases retain the old role literal. Regenerate or update these duplicate request types so every endpoint represented by the changed schemas accepts the same messages.

Useful? React with 👍 / 👎.

The role of the message input. One of `user`, `assistant`, `system`, or `developer`.
enum:
- user
- assistant

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Regenerate response models for assistant input items

When an assistant input is returned by responses.input_items.list, the changed InputMessageResource schema permits it, but ResponseInputMessageItem.role still excludes assistant; the alternative ResponseOutputMessage cannot parse its input_text content, so SDK response validation fails instead of returning the item. The beta response model has the same mismatch. Regenerate the response-side models as well as the request aliases so returned assistant inputs deserialize correctly.

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

Useful? React with 👍 / 👎.

The role of the message input. One of `user`, `assistant`, `system`, or `developer`.
enum:
- user
- assistant

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Regenerate the schema and its metadata together

Editing this generated specification changes its MD5 to ff0cd3df4caef970f68fce6b3a861161, while .castiron.stats.yml still records e37bbe0f04caa6093f1cb5d65d23ad03. As a result, scripts/mock exits with “Local OpenAPI specification does not match generation metadata,” and every normal ./scripts/test run that needs to start the local mock server stops before running tests. Regenerate the artifacts through the supported workflow rather than manually rewriting the generation metadata.

AGENTS.md reference: AGENTS.md:L16-L18

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 API: sending a client-authored assistant turn requires either a fake message id or a # type: ignore

1 participant