You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I ran fixture seed 142 against main 4358bc235e8641ba5f0cb54599675d098385d4bf, #1439b55aa6b9b8fa24756a6cacddf91dcbe4bfe5523, and #1487ed05b5f9e0247af49f1aa24abfd77ec30b4b597.
Ref
Cancel outcome
Fragments delivered
Final gRPC status
Live tasks/channels after 500 ms
main
aclose RuntimeError: asynchronous generator is already running; blocked read PENDING
Under this fixture, #143 and #148 preserved the measured invariant that cancellation converges to a clean terminal state without dangling tracked replay tasks or calls. All 3/3 independent repetitions per ref produced the same normalized result within that ref.
Harness, trace, and environment lock (harness commit 9655539bce02fd5aaa1ad41bf0e50cecf22dd6fa): public evidence gist (report sha256:8f3f2a21eef1bc2e733fadf59dd0c703c5589a9822bfcb192e76deb3e199912d; trace sha256:7284d81230894c360c0b5b4252e3b6145b93736225c4fe3bf8a311a818383bf5). Untested: the live xAI service, real gRPC/TCP channel ownership, SDK retries or retry backoff, and batch streaming. #143 is currently conflicting with main, so this is exact-head behavioral evidence, not integration evidence.
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
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.
Summary
chat.stream()while preserving existingasync forusagecancel()andaclose()so callers can stop the underlying gRPC stream earlyCloses #142
Tests
uv run pytest tests/aio/chat_test.py -quv run pytest tests/aio/chat_test.py::test_stream_cancel_cancels_underlying_rpc tests/aio/chat_test.py::test_streaming tests/aio/chat_test.py::test_stream_creates_span_with_correct_attributes -quv run ruff check src/xai_sdk/aio/chat.py tests/aio/chat_test.pyuv run pyright src/xai_sdk/aio/chat.py tests/aio/chat_test.pyuv run ruff format --check src/xai_sdk/aio/chat.py tests/aio/chat_test.pygit diff --check