feat(client): add request timeout and retry with backoff#36
Merged
Conversation
Adds a 30s default request timeout and a retry interceptor that handles
transient failures so the CLI no longer hangs forever on network drops
or fails immediately on 429/5xx blips.
Retry policy:
- retryable: 429, 5xx, and ECONNRESET/ECONNABORTED/ETIMEDOUT/
ENOTFOUND/EAI_AGAIN network errors
- non-retryable: 4xx other than 429
- up to 3 attempts after the initial request
- exponential backoff: 1s, 2s, 4s
- 429 responses honor the Retry-After header when present
Configurable via env (no config schema changes):
- JIRA_CLI_TIMEOUT_MS (default: 30000)
- JIRA_CLI_MAX_RETRIES (default: 3, set to 0 to disable retries)
github-actions Bot
pushed a commit
that referenced
this pull request
May 10, 2026
# [2.8.0](v2.7.0...v2.8.0) (2026-05-10) ### Features * **client:** add request timeout and retry with backoff ([#36](#36)) ([8a99787](8a99787))
|
🎉 This PR is included in version 2.8.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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
Add a 30s default request timeout and a retry interceptor in
lib/jira-client.jsso the CLI:Retry policy
Retry-Afterheader if present, otherwise exponential backoffECONNRESET,ECONNABORTED,ETIMEDOUT,ENOTFOUND,EAI_AGAINThe interceptor is applied to all three axios clients (
clientV2,clientV3,agileClient) via a sharedcreateAxiosClienthelper, removing duplication from the previous per-client interceptor setup.Configuration (env-only, no config schema changes)
JIRA_CLI_TIMEOUT_MSJIRA_CLI_MAX_RETRIESInvalid or non-positive values fall back to defaults.
Why
The previous client had no timeout and no retry logic — a transient 503 or rate-limit response was a hard failure, and a stalled connection would hang the CLI indefinitely. Long-running scripts (e.g. CI bulk operations) and users on flaky networks were the most affected.
Test plan
npm test— 273 tests pass (+22 new)npm run lint— cleanshouldRetry(429, 5xx, network codes, 4xx skip)computeRetryDelay(exponential backoff,Retry-Afterlowercase + capitalized, fallback)MAX_RETRIES=0disables retries, exponential backoff sequence verified)