Forward the cancellation token in the synchronous ModifyAssistant - #1272
Open
adityasingh2400 wants to merge 5 commits into
Open
Forward the cancellation token in the synchronous ModifyAssistant#1272adityasingh2400 wants to merge 5 commits into
adityasingh2400 wants to merge 5 commits into
Conversation
adityasingh2400
requested review from
MaiLinhP,
joseharriaga and
jsquire
as code owners
August 5, 2026 15:51
The synchronous AssistantClient.ModifyAssistant convenience overload passed a literal null to the protocol method instead of the caller's cancellation token, so the token was dropped and the request could not be cancelled. Its own asynchronous twin and every other convenience method on the client already forward the token through ToRequestOptions. Added a mock-transport regression test covering both overloads.
adityasingh2400
force-pushed
the
fix-modify-assistant-cancellation-token
branch
from
August 11, 2026 00:48
36abd80 to
9735567
Compare
…cancellation-token # Conflicts: # CHANGELOG.md
# Conflicts: # CHANGELOG.md
jsquire
reviewed
Aug 13, 2026
upstream' into HEAD Claude-Session: https://claude.ai/code/session_0189zxefNUxZmXLRED6jPeMy
Contributor
Author
|
Good catch, that was a real gap. Now branched on if (IsAsync)
{
Assert.That(
async () => await client.ModifyAssistantAsync("asst_abc", new AssistantModificationOptions(), cancellationSource.Token),
Throws.InstanceOf<OperationCanceledException>());
}
else
{
Assert.That(
() => client.ModifyAssistant("asst_abc", new AssistantModificationOptions(), cancellationSource.Token),
Throws.InstanceOf<OperationCanceledException>());
}One thing I should be straight about: I could not run this locally. |
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.
The synchronous
AssistantClient.ModifyAssistantoverload passed a literalnullto the protocol method instead of the caller's cancellation token, so the token was dropped before the request was sent and the call could not be cancelled. Every other convenience method on this client already forwards its token throughToRequestOptions, includingModifyAssistant's own asynchronous twin one method above it, so this was an isolated gap rather than a deliberate difference. The change makes the synchronous overload match its sibling and honor the behavior its own documentation comment describes. Callers who pass a default token see no change at all, becauseToRequestOptionsreturnsnullfordefault, which is exactly what was being passed before. The added mock transport regression test exercises both overloads and fails only on the synchronous one without this fix.