Stabilize task cancellation cleanup test#1712
Open
lntutor wants to merge 1 commit into
Open
Conversation
|
|
||
| // Cleanup | ||
| await client.CancelTaskAsync(taskId, ct); | ||
| await _toolCancellationFired.Task.WaitAsync(TestConstants.DefaultTimeout, ct); |
Contributor
There was a problem hiding this comment.
The other tests wait for this condition to assert that a client cancel makes its way into the server tool call and the cancellation is actually observed. This test is not validating that so it's not needed.
The correct cleanup should actually be handled by the server during disposal. This is a separate issue tracked in #1707.
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.
Fixes #1701.
Summary
TaskTool_CancellationToken_GetTaskShowsWorkingBeforeCancelcancelled its infinite-delay tool during cleanup but immediately began client/server teardown. Unlike the adjacent explicit-cancellation test, it never waited for the tool to observe cancellation, leaving teardown to race a still-running request.This waits on the test’s existing
_toolCancellationFiredsignal withTestConstants.DefaultTimeoutand the xUnit cancellation token before disposal.Tests
TaskCancellationIntegrationTestsclass (6 passed)dotnet build ModelContextProtocol.slnx(36 projects, 0 warnings)dotnet format --verify-no-changesModelContextProtocol.Testsproject: 6,864 passed; the three failures areDockerEverythingServerTests.Sampling_Sse_EverythingServer, which reproduce on cleanupstream/mainbecause the local Everything Server container lackstrigger-sampling-request