Skip to content

fix(types): restrict response.steer request inputs - #3793

Open
sylvesterkaczmarek wants to merge 8 commits into
openai:mainfrom
sylvesterkaczmarek:fix/steer-input-wire-contract
Open

fix(types): restrict response.steer request inputs#3793
sylvesterkaczmarek wants to merge 8 commits into
openai:mainfrom
sylvesterkaczmarek:fix/steer-input-wire-contract

Conversation

@sylvesterkaczmarek

Copy link
Copy Markdown

Summary

The response.steer contract added in 3.8.0 accepts only user messages. Its generated request parameter types currently expose unsupported function_call_output items and server-returned fields (id, status, and beta agent), and require the message type discriminator even though the contract documents it as optional.

This narrows the stable and beta request parameter types to the actual wire contract:

  • only user messages are accepted as item-list inputs;
  • request messages expose only content, role, and optional type;
  • type, when present, remains limited to message.

The response-side models remain unchanged so failed steering events can still deserialize the original rejected input returned by the server.

Tests

Adds regression checks for the stable and beta TypedDict shapes, required keys, and message-only item aliases.

@sylvesterkaczmarek
sylvesterkaczmarek requested a review from a team as a code owner September 3, 2026 21:04
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 3, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-03T21:08:48.463375Z 7abcb79 PR opened
🔒 Security Review Completed 2026-09-03T21:07:56.424204Z 7abcb79 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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

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

message = steer_param.ResponseSteerInputItemListMessage

assert set(message.__annotations__) == {"content", "role", "type"}
assert set(message.__required_keys__) == {"content", "role"}

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 Avoid checking required keys under postponed annotations

Because both parameter modules enable from __future__ import annotations, Required[...] is stored as a forward reference when the TypedDict class is created, so message.__required_keys__ is empty rather than {"content", "role"}. This assertion—and the equivalent beta assertion—therefore fails on every supported Python version; verify requiredness through resolved type hints instead.

Useful? React with 👍 / 👎.

@sylvesterkaczmarek sylvesterkaczmarek left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This corrects the request schema, but it also deletes previously importable symbols such as ResponseSteerInputItemListFunctionCallOutput and its caller types. Existing code importing those names will now fail with ImportError before making any request. Could these remain as deprecated aliases for a compatibility window?

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