feat(api): add service-account API key expiration fields - #3802
Conversation
Castiron-Internal-PR: openai/openai-python-internal#84 Castiron-Source-SHA: 6eefcc34b79ca8c3087a3f6ee6fbbaf5b8ac7510 Castiron-Public-Base-SHA: 2a98f6a
Castiron custom code✅ No new custom-code files detected. 36 mixed files remain; 0 existing customizations changed; 5 generated baselines changed. Compared
31 existing customizations unchanged
A changed generated baseline means this report cannot reliably identify which handwritten lines changed. Inspect the custom-code diffDownload the exact patch produced by this run (requires repository access): gh run download 34272245772 --repo openai/openai-python \
--name castiron-custom-code-34272245772-1 --dir /tmp/castiron-custom-code-34272245772-1
git apply --stat /tmp/castiron-custom-code-34272245772-1/custom-code.patch
cat /tmp/castiron-custom-code-34272245772-1/custom-code.patchOr reproduce it from an SDK checkout containing the vendored reporter: git fetch --no-tags origin 182af73b39998d51ad672bbd9c200ee3f4121fad 2bdf7d7a1d3781b5281d5517efb5883f5a7d07cc
python3 scripts/castiron/custom_code_report.py report \
--base 182af73b39998d51ad672bbd9c200ee3f4121fad \
--head 2bdf7d7a1d3781b5281d5517efb5883f5a7d07cc --fetch --require-head-hash --public \
--out /tmp/castiron-custom-code-2bdf7d7a1d37
cat /tmp/castiron-custom-code-2bdf7d7a1d37/custom-code.patchThis is the current full custom patch for mixed files, not an attribution of only the handwritten lines changed by this PR. |
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: 7863fba588
ℹ️ 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".
| if isinstance(event_type, str) and event_type and event_type != "error": | ||
| self._reconnect_attempt = 0 |
There was a problem hiding this comment.
Reset retries after recoverable error events
When a successful reconnect is followed by a normal request-level error event, this condition leaves the previous attempt count active even though RealtimeErrorEvent explicitly documents that most errors are recoverable and the session remains open. If that healthy session later experiences an unrelated network disconnect before producing a non-error event, reconnection starts from the stale count and can eventually be refused after several independent incidents. Distinguish admission failures from recoverable application errors instead of treating every type == "error" event as a failed reconnect; the same condition is duplicated in the sync and Responses connection implementations.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
I checked the actual sync/async Realtime, Responses, and beta Responses connection classes. For Realtime, session.created is the first event on an established connection; it resets the count before later recoverable errors. A probe starting at the retry limit, receiving that event and then a request error, reconnects at attempt 1 after a later network close.
For a Responses connection that has received only errors since reconnecting, your observation about retaining the count is correct. This guard currently requires a non-error application event (such as response.created) to replenish the budget. Error events remain available to the caller and do not themselves close the connection or consume another retry. Resetting on a subset of errors needs a reliable distinction from errors followed by admission failure/closure, so I am preserving the current behavior pending maintainer agreement on that policy rather than adding an unverified classification. Leaving this thread open for that decision.
sylvesterkaczmarek
left a comment
There was a problem hiding this comment.
The reconnect counter is reset only in recv() after the parsed event is known to be non-error. The byte-oriented receive path still calls recv_bytes() directly, so a caller using that public API can successfully receive frames after a reconnect without ever clearing _reconnect_attempt. Separate transient disconnects would then consume one shared retry budget across otherwise healthy periods until a later reconnect is refused. Is the raw receive path intentionally excluded from the new retry semantics? If not, it would be useful to cover reconnect -> successful raw frame -> disconnect again and make sure the budget resets without treating an application error event as success.
Automated Release PR --- ## [3.10.0](openai/openai-python@v3.9.0...v3.10.0) (2026-09-08) ### Features * **api:** add GPT Image 2.5 models and image options ([openai#3824](openai#3824)) ([5b39c45](openai@5b39c45)) * **api:** add service-account API key expiration fields ([openai#3802](openai#3802)) ([f1cd7f0](openai@f1cd7f0)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: openai-sdks[bot] <284451331+openai-sdks[bot]@users.noreply.github.com>
Summary
Adds optional expiration fields for service-account API keys, clarifies the Responses store option, and honors WebSocket retry limits across repeated reconnects.
Changes