Repository navigation
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. |
Author
|
@codex review |
|
Codex Review: Something went wrong. Try again later by commenting “@codex review”. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📥 Pull Request
📘 Description
When an OpenAI synchronous chat stream raises during iteration,
OpenaiStreamWrapper.__next__propagates the exception but leaves its span recording and attached. The failed call is not exported, and subsequent operations can inherit it as their parent.Record the exception and ERROR status before re-raising, and share idempotent span/context cleanup across iteration failure, normal exhaustion and context-manager exit. This also prevents repeated
end()and context detachment when an exhausted stream exits awithblock. An ended wrapper consistently raisesStopIterationon subsequent reads.The change is limited to the synchronous chat wrapper and its tests, based directly on main. It preserves the original exception and yielded chunk objects. Async streams, Responses API wrappers and underlying HTTP stream closure are outside this change.
🧪 Testing
httpx.MockTransportresponses. They cover successful/error iteration with and without a manager, catching an error inside a manager, exception/chunk identity, caller exceptions, and repeated reads after termination. On unchanged main: 6 failures, 1 pass; with this fix: 7 pass.tests/unitwith coverage, Python 3.12.13 / Windows and complete test/dev groups fromuv.lock: 495 passed, 1 existing skip, with no test exclusions. OpenAI 1.71.0, OpenTelemetry SDK 1.31.1 and pytest 8.3.5.pdband disables optionalreadline, bypassing a legacy pdbpp/pyreadline startup incompatibility. No production code or installed dependency files are changed by the launcher. The suite still emits closed-log-stream messages during process shutdown.git diff --checkpass.Real provider requests, Linux CI and the remaining Python-version matrix have not been run locally.