fix: convert maxRetries to gRPC maxAttempts correctly#287
Merged
Conversation
…→maxAttempts conversion The createServiceConfig() function used the maxRetries option value directly as the gRPC maxAttempts field. However, gRPC's maxAttempts includes the initial attempt, while maxRetries means retries after the initial call. This caused users to get one fewer retry than configured. Setting maxRetries: 0 also produced an invalid maxAttempts: 0 config. Fix: Add +1 when converting maxRetries to maxAttempts. Also add comprehensive unit tests for the entire retry-policy module which previously had zero test coverage. Fixes #221 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes the Azure Managed SDK’s gRPC retry service config generation by correctly translating user-facing maxRetries (retries after the initial call) into gRPC maxAttempts (total attempts including the initial call), addressing the off-by-one behavior reported in #221.
Changes:
- Adjust
createServiceConfig()to computemaxAttemptsasmaxRetries + 1whenmaxRetriesis provided. - Add unit tests covering default service config validity, maxRetries→maxAttempts conversion (including
0), backoff formatting, and retryable status code mapping/behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/durabletask-js-azuremanaged/src/retry-policy.ts | Fixes maxRetries → gRPC maxAttempts conversion logic to include the initial attempt. |
| packages/durabletask-js-azuremanaged/test/unit/retry-policy.spec.ts | Adds unit coverage for the service config generator (defaults, conversion semantics, backoff formatting, status code handling). |
kaibocai
approved these changes
Jul 8, 2026
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.
Summary
Fixes #221