Repository navigation
fix: stop endpoint output streams after job cancellation - #622
Draft
Kayvan-Zahiri wants to merge 1 commit into
Draft
Kayvan-Zahiri wants to merge 1 commit into
Kayvan-Zahiri wants to merge 1 commit into
Conversation
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.
Sync and async
Job.stream()keep polling after the API returnsCANCELLEDbecauseFINAL_STATESomits that status.is_completed()already considers it terminal, so status/output polling and stream polling disagree. A cancelledrun_syncresponse also falls through to unnecessary status fetching.Add
CANCELLEDto the shared terminal states and haveis_completed()use that same list. Streams still yield a final buffered chunk before stopping on the subsequent empty terminal response.Usage:
The same behavior applies to
async for chunk in job.stream().Validation:
run_syncreturning a cancelled response without further polling.run_synccheck also exposes the fall-through.git diff --checkpass.-o addopts=''because the repository-wide 90% coverage threshold is not meaningful for an endpoint-only run. The initial invocation passed its tests but failed that global coverage gate. Full repository coverage is not claimed.AI assistance: Codex independently investigated, reproduced, implemented, and tested this fix with the account owner's authorization. Draft for maintainer review; no human implementation review yet.