fix(types): restrict response.steer request inputs - #3793
fix(types): restrict response.steer request inputs#3793sylvesterkaczmarek wants to merge 8 commits into
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 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"} |
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
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?
Summary
The
response.steercontract added in 3.8.0 accepts only user messages. Its generated request parameter types currently expose unsupportedfunction_call_outputitems and server-returned fields (id,status, and betaagent), and require the messagetypediscriminator even though the contract documents it as optional.This narrows the stable and beta request parameter types to the actual wire contract:
content,role, and optionaltype;type, when present, remains limited tomessage.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.