-
Notifications
You must be signed in to change notification settings - Fork 374
fix: implement retry logic for creating test suites to handle concurr… #844
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
fix: implement retry logic for creating test suites to handle concurr… #844
Conversation
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
There was a problem hiding this 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 pull request adds retry logic with exponential backoff to handle concurrency conflicts when creating test suites in Azure DevOps. The enhancement addresses transient errors caused by simultaneous updates from multiple users or processes.
Changes:
- Added retry mechanism with exponential backoff and jitter for the
create_test_suitetool to handle concurrency conflicts - Implemented error detection for specific Azure DevOps concurrency error codes (TF26071)
- Enhanced error messaging for maximum retry scenarios
| // Check if it's a concurrency conflict error | ||
| const isConcurrencyError = errorMessage.includes("TF26071") || errorMessage.includes("got update") || errorMessage.includes("changed by someone else"); |
Copilot
AI
Jan 16, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The concurrency error detection logic uses string matching on error messages, which is fragile and may break if error message formats change. Consider checking if the error object has specific error codes or types that can be used for more reliable error classification. If the Azure DevOps API provides structured error codes, use those instead of string matching.
| // Check if it's a concurrency conflict error | |
| const isConcurrencyError = errorMessage.includes("TF26071") || errorMessage.includes("got update") || errorMessage.includes("changed by someone else"); | |
| // Prefer structured error information when available | |
| const typedError = error as { statusCode?: number; code?: string; message?: string }; | |
| const statusCode = typeof typedError?.statusCode === "number" ? typedError.statusCode : undefined; | |
| const errorCode = typeof typedError?.code === "string" ? typedError.code : undefined; | |
| // Check if it's a concurrency conflict error | |
| const isConcurrencyError = | |
| statusCode === 409 || // HTTP 409 Conflict | |
| errorCode === "ConcurrencyConflictException" || // Azure DevOps concurrency error code (if provided) | |
| errorMessage.includes("TF26071") || | |
| errorMessage.includes("got update") || | |
| errorMessage.includes("changed by someone else"); |
|
@danhellem I've opened a new pull request, #845, to work on those changes. Once the pull request is ready, I'll request review from you. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Addresses code review feedback to improve maintainability of the retry logic for creating test suites. ## Changes - Extracted hardcoded jitter value (200ms) as `const jitterMax = 200` - Placed constant alongside existing `maxRetries` and `baseDelay` for consistency ```typescript const maxRetries = 5; const baseDelay = 500; // milliseconds const jitterMax = 200; // milliseconds // Later in exponential backoff calculation: const delay = baseDelay * Math.pow(2, attempt) + Math.random() * jitterMax; ``` <!-- START COPILOT CODING AGENT TIPS --> --- 💬 We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey). --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: danhellem <10525048+danhellem@users.noreply.github.com> Co-authored-by: Dan Hellem <dahellem@microsoft.com>
This pull request introduces a retry mechanism with exponential backoff for handling concurrency conflicts when creating a child test suite in the
configureTestPlanToolsfunction. This makes the process more robust and resilient to transient errors caused by concurrent updates.Improvements to error handling and reliability:
src/tools/test-plans.ts. This helps mitigate issues caused by simultaneous updates from multiple users or processes. [1] [2]GitHub issue number #839
Associated Risks
None
✅ PR Checklist
🧪 How did you test it?
Tested manually and re-ran automated tests