fix: make OpenAI exceptions pickleable - #3733
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4f2351168d
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 65e4756fd7
ℹ️ 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".
|
Addressed both review findings: transport-backed request/response state is now snapshotted and rebuilt as plain HTTP objects during unpickling, with regressions through real sync and async client transports. Reconstruction also bypasses subclass new, with coverage for user-defined OpenAIError subclasses. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 470fc2f5eb
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 75ee9cdf08
ℹ️ 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".
|
Addressed all five findings from the latest review: request URLs/bodies and raw response bodies are no longer serialized, sensitive response headers are redacted, timeout metadata is preserved, and legacy httpx request/response objects are handled through safe snapshots. Added focused privacy and legacy sync/async regression coverage. |
Summary
OpenAIErrorsubclasses pickleable without retaining live HTTP transport statehttpx2objects during unpicklingOpenAI-Organization,OpenAI-Project, and arbitrary customer metadataelapsed, and safe protocol metadata (http_versionandreason_phrase)httpx2and the SDK's legacyhttpxcompatibility lane__dict__and__slots__state without replaying custom constructors or subclass__new__methodsFixes #2629
Test plan
uv run ruff format --check src/openai/_exceptions.py tests/test_exceptions_pickle.py— passeduv run ruff check src/openai/_exceptions.py tests/test_exceptions_pickle.py— passeduv run pytest -o addopts= -q tests/test_exceptions_pickle.py— passed./scripts/lintandgit diff --check— passed__new__and slotted-subclass coverage, request/response privacy checks, timeout preservation, response protocol metadata, credential/customer-identifier redaction, WebSocket payload omission, response elapsed preservation, and legacy sync/asynchttpxcompatibility coverage.action_requiredwith no jobs started; the external-contributor workflows are waiting for maintainer approval.