FIX finish WebSocket conversation cleanup before cancellation - #2428
Merged
Roman Lutz (romanlutz) merged 5 commits intoAug 22, 2026
Merged
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 5cd848f4-78c8-4b36-83c6-70f07c323896
Justin Song (jsong468)
approved these changes
Aug 19, 2026
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 5cd848f4-78c8-4b36-83c6-70f07c323896
Python 3.10 replaces a task's propagated CancelledError and drops its chained cause. Assert the cross-version contract—the cancellation itself—while retaining coverage that close() fails and completes exactly once. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 5cd848f4-78c8-4b36-83c6-70f07c323896
Continue checking the chained close failure on Python 3.11 and newer while accounting for Python 3.10 replacing the propagated CancelledError. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 5cd848f4-78c8-4b36-83c6-70f07c323896
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.
Description
Per-conversation WebSocket cleanup removed the connection from tracking before awaiting
close(). If the cleanup task was cancelled at that point, the socket could remain open with no tracked handle available for later cleanup.This change aligns
cleanup_conversation_async()with the target's existing whole-target cleanup contract: it shields the close operation, waits for it to finish, and then propagatesCancelledError.Tests and Documentation
Added a deterministic unit test that cancels cleanup while
close()is blocked and verifies:Validation included 31 focused WebSocket tests, 1,856 attack/scenario/WebSocket tests, Ruff, targeted
ty, pre-commit hooks, andgit diff --check.Documentation changes were not applicable. JupyText was not run because no notebook or documentation source changed.