Use retryable HTTP requests for Vault API#1375
Merged
hexedpackets merged 1 commit intomainfrom Oct 29, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Greptile Overview
Greptile Summary
Extends retry logic to Vault API endpoints and adds 408 timeout status to retryable codes.
- Centralized retry path detection into
HttpClient.isPathRetryable()method that checks for/fga/or/vault/path prefixes - Added
408(Request Timeout) to the list of retryable HTTP status codes alongside existing500,502,504 - Applied retry logic consistently across both
FetchHttpClientandNodeHttpClientimplementations - Comprehensive test coverage added for all Vault HTTP methods (GET, POST, PUT, DELETE)
Confidence Score: 5/5
- This PR is safe to merge with minimal risk
- Clean refactoring with comprehensive test coverage, consistent implementation across both HTTP clients, and sensible addition of timeout handling to retry logic
- No files require special attention
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| src/common/net/http-client.ts | 5/5 | Added isPathRetryable helper method to centralize retry path logic for /fga/ and /vault/ endpoints, added 408 to retryable status codes |
| src/common/net/fetch-client.ts | 5/5 | Replaced hardcoded /fga/ checks with HttpClient.isPathRetryable() in GET, POST, PUT, DELETE methods |
| src/common/net/node-client.ts | 5/5 | Replaced hardcoded /fga/ checks with HttpClient.isPathRetryable() in GET, POST, PUT, DELETE methods |
Sequence Diagram
sequenceDiagram
participant Client
participant HttpClient
participant FetchClient
participant API
Client->>HttpClient: Request to /vault/v1/kv
HttpClient->>HttpClient: isPathRetryable(path)
Note over HttpClient: Returns true for /fga/ and /vault/
alt Path is retryable
HttpClient->>FetchClient: fetchRequestWithRetry()
loop Up to 3 retry attempts
FetchClient->>API: Make HTTP request
alt Success (2xx)
API-->>FetchClient: Response
FetchClient-->>Client: Return response
else Retryable error (408, 500, 502, 504, TypeError)
API-->>FetchClient: Error response
FetchClient->>FetchClient: sleep(backoff * jitter)
Note over FetchClient: Backoff: 500ms * 1.5^attempt
end
end
alt Max retries exceeded
FetchClient-->>Client: Throw error
end
else Path not retryable
HttpClient->>FetchClient: fetchRequest()
FetchClient->>API: Make HTTP request (no retry)
API-->>FetchClient: Response
FetchClient-->>Client: Return response
end
5 files reviewed, no comments
nicknisi
approved these changes
Oct 29, 2025
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.
Description
By default API requests will immediately fail. FGA endpoints are the exception that use a wrapper to retry some failures. This adds Vault paths to the same retry logic. It also adds
408response codes to the list of retryable codes -408is set by the SDK when catching/rethrowing a request timeout.Documentation
Does this require changes to the WorkOS Docs? E.g. the API Reference or code snippets need updates.
If yes, link a related docs PR and add a docs maintainer as a reviewer. Their approval is required.