Skip to content

Conversation

@danhellem
Copy link
Contributor

@danhellem danhellem commented Jan 16, 2026

This pull request introduces a retry mechanism with exponential backoff for handling concurrency conflicts when creating a child test suite in the configureTestPlanTools function. This makes the process more robust and resilient to transient errors caused by concurrent updates.

Improvements to error handling and reliability:

  • Added a retry loop (up to 5 attempts) with exponential backoff and jitter when a concurrency conflict error is detected during the creation of a child test suite in src/tools/test-plans.ts. This helps mitigate issues caused by simultaneous updates from multiple users or processes. [1] [2]
  • Enhanced error messaging by returning a specific error if the maximum number of retries is exceeded.

GitHub issue number #839

Associated Risks

None

PR Checklist

  • I have read the contribution guidelines
  • I have read the code of conduct guidelines
  • Title of the pull request is clear and informative.
  • 👌 Code hygiene
  • 🔭 Telemetry added, updated, or N/A
  • 📄 Documentation added, updated, or N/A
  • 🛡️ Automated tests added, or N/A

🧪 How did you test it?

Tested manually and re-ran automated tests

@danhellem danhellem requested a review from a team as a code owner January 16, 2026 20:32
@danhellem danhellem requested a review from Copilot January 16, 2026 20:32
@github-actions
Copy link

github-actions bot commented Jan 16, 2026

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@danhellem danhellem linked an issue Jan 16, 2026 that may be closed by this pull request
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 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_suite tool to handle concurrency conflicts
  • Implemented error detection for specific Azure DevOps concurrency error codes (TF26071)
  • Enhanced error messaging for maximum retry scenarios

Comment on lines +128 to +129
// Check if it's a concurrency conflict error
const isConcurrencyError = errorMessage.includes("TF26071") || errorMessage.includes("got update") || errorMessage.includes("changed by someone else");
Copy link

Copilot AI Jan 16, 2026

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.

Suggested change
// 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");

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Copilot AI commented Jan 16, 2026

@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.

danhellem and others added 3 commits January 16, 2026 15:40
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Issue while creating multiple test suites

2 participants