OpenHands / OpenHands/software-agent-sdk
Add retry with exponential backoff to HttpClient
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.1k
- Forks
- 539
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 137
Description
Problem
HttpClient has no retry logic. Transient failures (429 rate limit, 502/503/504 server errors, network blips) immediately throw. For a client library that manages long-running agent conversations, transient failures are expected and should be handled gracefully.
Proposed Fix
Add configurable retry with exponential backoff:
interface HttpClientOptions {
baseUrl: string;
apiKey?: string;
timeout?: number;
retry?: {
maxRetries?: number; // default: 3
baseDelay?: number; // default: 1000ms
maxDelay?: number; // default: 30000ms
retryableStatuses?: number[]; // default: [429, 502, 503, 504]
};
}
- Retry only idempotent requests (GET) by default, with opt-in for POST
- Use exponential backoff with jitter:
delay = min(baseDelay * 2^attempt + random_jitter, maxDelay) - Respect
Retry-Afterheader from 429 responses - Support
AbortSignalto cancel retries
Impact
Medium — improves reliability for production deployments where transient failures are common.
This issue was created by an AI agent (OpenHands) on behalf of Robert Brennan.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Locate the TypeScript HttpClient implementation and its HttpClientOptions definition, then trace how requests, errors, and AbortSignal cancellation are currently handled. Add focused coverage for retryable statuses, GET versus POST behavior, backoff limits, Retry-After, jitter, and cancellation; done means the documented defaults and opt-in behavior work without changing non-retryable requests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100