Repository navigation
feat(functions): add opt-in durable HTTP failure retries - #377
Merged
Merged
Conversation
Add HttpRetryOptions and serialize its policy and status-code snapshot for the built-in HTTP activity. Reuse durable RetryPolicy execution, preserve calls without options, and match .NET in-process initial-request-only retry semantics. Closes #367 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: e0af01a5-0dfa-4e71-a660-c4186e65d7e0
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Retriable responses are fully buffered before status evaluation, which can delay or prevent durable retries for large or non-terminating bodies.
Review effort: Balanced
Findings: 1
What changed in this PR
Adds opt-in durable HTTP retries to classic callHttp, reusing core activity retries and preserving separate 202 polling behavior.
Changes:
- Adds and exports
HttpRetryOptions. - Applies durable retries to configured HTTP statuses and transport failures.
- Documents behavior and adds replay, timeout, polling, and exhaustion tests.
| File | Description |
|---|---|
src/http/models.ts |
Defines HTTP retry options and payload fields. |
src/http/builtin.ts |
Applies retry policies to initial HTTP requests. |
src/orchestration-context.ts |
Snapshots retry configuration into durable requests. |
src/index.ts |
Exports HttpRetryOptions. |
test/unit/http-retry.spec.ts |
Tests HTTP retry execution and replay. |
test/unit/orchestration-context.spec.ts |
Tests policy validation and serialization. |
README.md |
Documents usage and semantics. |
CHANGELOG.md |
Records the feature. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Classify selected HTTP failures as soon as headers arrive and cancel their unused body so an open response cannot block durable retries. Keep returned response bodies intact and restore unrelated baseline formatting. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: e0af01a5-0dfa-4e71-a660-c4186e65d7e0
kaibocai (kaibocai)
approved these changes
Oct 2, 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
What changed?
HttpRetryOptionsandcallHttp({ retryOptions }), snapshotting the policy and status list into the durable request.Why is this change needed?
Previously
callHttpreturned error status responses without durable failure retries. With explicit options it now retries selected responses, returns excluded statuses, and throwsTaskFailedErroron exhaustion rather than returning the last failed response.The reference is the .NET in-process Durable Functions extension, not the generic .NET SDK:
HttpRetryOptions: backoff 1, six-day interval cap, unlimited retry timeout by default.TaskHttpActivityShim: omitted/empty status lists use non-2xx semantics (including 4xx/5xx and unfollowed 3xx); explicit lists are exact, including 202.CreateLocationPollRequestdoes not propagate retry options. This PR matches that boundary: initial requests retry; subsequent 202 Location polls do not. Initial503 -> 202 -> poll 503therefore returns the poll's 503 without retrying it.Omitting options preserves current behavior. Existing polling, redirects, credential stripping, and URL validation are unchanged. README documents JavaScript millisecond/
-1conventions, core retry-timeout boundaries, idempotency considerations, and versioning/draining in-flight instances before enabling retries.Issues / work items
Project checklist
packages/azure-functions-durable/CHANGELOG.mdAI-assisted code disclosure (required)
Was an AI tool used? (select one)
If AI was used:
AI verification (required if AI was used):
Testing
Validated commit:
57efe8bda358ad450a9b92af2f4b8f3a519df379, tree800a2a6d1d918a3cbd040956d122b169a304087a. This exact commit was tested before the ordinary follow-up push.Automated tests
npm run build -w durable-functions(includes core build),npm run build -w @microsoft/durabletask-js-azuremanaged, scoped ESLint, changed-range/README formatting checks,git diff --check, and normal Husky/lint-staged commit checks. Existing baseline formatting was retained rather than rewriting unrelated code.Real Azure validation
2026-10-02, first and only live run: 6/6 scenarios passed. Windows / Node.js 24.14.0; a new, isolated Consumption task hub in westus2, with hub-scoped data access and a restricted IP allowlist.
The local Azure-managed SDK worker executed the public Functions
callHttpwrapper and unchanged built-in HTTP activity/poll orchestrator against production Azure DTS. Authenticated TLSHelloand a missing-instance read passed first. Scheduling, dispatch, persistence, failures, retry timers, and history reads used the real service; no generated work items or synthetic timer events were used in this run.TaskFailedErrorTotals: 12 HTTP requests, 6 TaskFailed events, 6 TimerCreated and 6 TimerFired events. Root replay observations and exact HTTP request counts passed. The polling request changed POST to GET, dropped the request body and
x-functions-key, retained the same-origin fixture authorization header, and carried no retry policy.The stalled-body server recorded the first POST at
15:23:47.034Z, client cancellation without a server-side end at15:23:47.046Z, and the next POST at15:23:47.326Z.Evidence integrity: candidate HEAD was unchanged before/after execution; harness SHA-256 was unchanged at
3b845b47dcc86cce408bdb0491b5c52cb42bc8c81ab42a93a9be2f16ce0f0195; source and compiled module hashes were recorded and independently read back. Raw histories and cleanup evidence are retained locally, not published with private environment identifiers.Cleanup: all 12 exact root/child instance IDs were individually purged and verified absent; the worker, client, and HTTP server stopped. The temporary role assignment and task hub were separately verified absent, and the scheduler/resource group were removed with
az group existsreturningfalse. No test infrastructure remains.Scope limits: HTTP responses came from a controlled loopback server. This was not an Azure Functions-host deployment, cloud HTTP endpoint, load test, or simulated Azure service outage. Import-time Functions registration was in test mode; the actual HTTP built-ins were explicitly registered in the real Azure-managed worker. Local Functions-host/Azurite E2E and full repository suites were not run for this follow-up. Hosted CI is tracked separately and is not substituted for the live feature-specific evidence above.
Notes for reviewers