Skip to content

Great Cancellation Finale: Tying Up Loose Ends#2005

Open
msalaman wants to merge 4 commits intomainfrom
masalama/removeCancellationTokenNone
Open

Great Cancellation Finale: Tying Up Loose Ends#2005
msalaman wants to merge 4 commits intomainfrom
masalama/removeCancellationTokenNone

Conversation

@msalaman
Copy link
Contributor

@msalaman msalaman commented Mar 10, 2026

What does this PR do?

Update CosmosService to use cancellationToken where not supported in method and use timeout for async calls in Dipose method
Update LoadTestingService to Pass in cancellationToken using RequestContext for AzureLoadTesting SDK calls

GitHub issue number?

#1583
#1767

Pre-merge Checklist

  • Required for All PRs
    • Read contribution guidelines
    • PR title clearly describes the change
    • Commit history is clean with descriptive messages (cleanup guide)
    • Added comprehensive tests for new/modified functionality
    • Updated servers/Azure.Mcp.Server/CHANGELOG.md and/or servers/Fabric.Mcp.Server/CHANGELOG.md for product changes (features, bug fixes, UI/UX, updated dependencies)
  • For MCP tool changes:
    • One tool per PR: This PR adds or modifies only one MCP tool for faster review cycles
    • Updated servers/Azure.Mcp.Server/README.md and/or servers/Fabric.Mcp.Server/README.md documentation
    • Validate README.md changes using script at eng/scripts/Process-PackageReadMe.ps1. See Package README
    • Updated command list in /servers/Azure.Mcp.Server/docs/azmcp-commands.md and/or /docs/fabric-commands.md
    • Run .\eng\scripts\Update-AzCommandsMetadata.ps1 to update tool metadata in azmcp-commands.md (required for CI)
    • For new or modified tool descriptions, ran ToolDescriptionEvaluator and obtained a score of 0.4 or more and a top 3 ranking for all related test prompts
    • For tools with new names, including new tools or renamed tools, update consolidated-tools.json
    • For renamed tools, follow the Tool Rename Checklist and tag the PR with the breaking-change label
    • For new tools associated with Azure services or publicly available tools/APIs/products, add URL to documentation in the PR description
  • Extra steps for Azure MCP Server tool changes:
    • Updated test prompts in /servers/Azure.Mcp.Server/docs/e2eTestPrompts.md
    • 👉 For Community (non-Microsoft team member) PRs:
      • Security review: Reviewed code for security vulnerabilities, malicious code, or suspicious activities before running tests (crypto mining, spam, data exfiltration, etc.)
      • Manual tests run: added comment /azp run mcp - pullrequest - live to run Live Test Pipeline

Copilot AI review requested due to automatic review settings March 10, 2026 16:49
@msalaman msalaman requested review from a team and xiangyan99 as code owners March 10, 2026 16:49
@msalaman msalaman changed the title Great Cancellation Finale Great Cancellation Finale: Tying Up Loose Ends Mar 10, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds cancellation token propagation to several async Azure SDK calls in the LoadTesting and Cosmos services that were previously missing cancellation support. This is part of a broader effort (titled "Great Cancellation Finale") to ensure cancellation tokens are consistently threaded through all async operations.

Changes:

  • Passes CancellationToken via RequestContext to Azure Load Testing SDK data-plane calls (GetTestRunAsync, BeginTestRunAsync, GetTestAsync, CreateOrUpdateTestAsync).
  • Adds WaitAsync(cancellationToken) to CosmosClient.ReadAccountAsync() which lacks a native cancellation token overload.
  • Injects IHostApplicationLifetime into CosmosService to replace CancellationToken.None with ApplicationStopping in the DisposeAsyncCore cleanup method.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
tools/Azure.Mcp.Tools.LoadTesting/src/Services/LoadTestingService.cs Adds RequestContext { CancellationToken = cancellationToken } to four data-plane SDK calls
tools/Azure.Mcp.Tools.Cosmos/src/Services/CosmosService.cs Adds cancellation to ReadAccountAsync via WaitAsync, injects IHostApplicationLifetime for disposal cancellation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Untriaged

Development

Successfully merging this pull request may close these issues.

2 participants