Skip to content

feat(delivery): support maximum backoff duration - #802

Open
kahirokunn wants to merge 7 commits into
knative-extensions:mainfrom
kahirokunn:feat/delivery-backoff-max
Open

feat(delivery): support maximum backoff duration#802
kahirokunn wants to merge 7 commits into
knative-extensions:mainfrom
kahirokunn:feat/delivery-backoff-max

Conversation

@kahirokunn

@kahirokunn kahirokunn commented Aug 21, 2026

Copy link
Copy Markdown
Member

Related upstream: knative/eventing#9278, implemented by knative/eventing#9279.

Proposed Changes

This PR adds native NATS support for Eventing's experimental DeliverySpec.backoffMax. The Eventing revision selected by go.mod is the merge commit of knative/eventing#9279, which defines backoffMax and retryAfterMax and their feature-gated validation.

  • Apply backoffMax to Broker and Trigger delivery, and expose it through NatsJetStreamChannel defaults and subscriber delivery.
  • Run the complete upstream DeliverySpec validation with Eventing feature flags available to the channel webhook.
  • Map JetStream's one-based delivery count to Eventing's zero-based backoff attempt, and pass subscriber response status and headers into Eventing's backoff calculation.

Retry behavior

Field Controls
backoffMax Delays calculated from backoffDelay and backoffPolicy
retryAfterMax Delays requested by Retry-After on HTTP 429 and 503 responses

The limits are independent. Eventing caps each delay separately and uses the larger result. Operators enable delivery-backoff-max, and additionally enable delivery-retryafter when using retryAfterMax.

Tests

Unit tests cover retry numbering, delivery propagation, feature-gated validation, and response-aware delay calculation. Experimental E2E tests cover backoffMax and retryAfterMax through both the NATS Broker and NatsJetStreamChannel, following Eventing's upstream backoffMax scenario and Retry-After assertions.

The KinD workflow follows Eventing's Kubernetes and suite matrix, Kind setup, and experimental-suite execution.

Eventing installation Suites Kubernetes
knative-v1.23.0 release Regular E2E v1.34.x, v1.35.x
Revision selected by go.mod Regular and experimental E2E v1.34.x, v1.35.x

Release Note

🎁 Add experimental DeliverySpec.backoffMax support to native NATS Broker and NatsJetStreamChannel delivery, and honor retryAfterMax when scheduling JetStream redeliveries.

Docs

Provider documentation is included for Broker delivery and NatsJetStreamChannel delivery. Upstream user documentation is tracked in knative/docs#6686.

@knative-prow knative-prow Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 21, 2026
@knative-prow

knative-prow Bot commented Aug 21, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: kahirokunn
Once this PR has been reviewed and has the lgtm label, please assign aliok for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow-robot knative-prow-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 21, 2026
@knative-prow knative-prow Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Aug 21, 2026
@knative-prow
knative-prow Bot requested review from aliok and pierDipi August 21, 2026 07:33
@kahirokunn
kahirokunn force-pushed the feat/delivery-backoff-max branch from 7c6bffb to 9e11239 Compare August 21, 2026 07:40
@knative-prow-robot knative-prow-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 21, 2026
@codecov

codecov Bot commented Aug 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 66.34615% with 70 lines in your changes missing coverage. Please review.
✅ Project coverage is 44.83%. Comparing base (0e4ba1f) to head (f85abce).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
test/experimental/features/delivery/feature.go 44.76% 53 Missing and 5 partials ⚠️
pkg/broker/filter/handler.go 0.00% 4 Missing ⚠️
test/experimental/features/delivery/matchers.go 88.88% 2 Missing and 2 partials ⚠️
pkg/webhook/controller.go 0.00% 3 Missing ⚠️
...channel/jetstream/dispatcher/message_dispatcher.go 75.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #802      +/-   ##
==========================================
+ Coverage   43.50%   44.83%   +1.33%     
==========================================
  Files          68       72       +4     
  Lines        4259     4447     +188     
==========================================
+ Hits         1853     1994     +141     
- Misses       2282     2321      +39     
- Partials      124      132       +8     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@kahirokunn
kahirokunn force-pushed the feat/delivery-backoff-max branch from 9e11239 to 860eb5d Compare August 21, 2026 08:58
@knative-prow-robot knative-prow-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 24, 2026
@kahirokunn
kahirokunn force-pushed the feat/delivery-backoff-max branch from 860eb5d to a63a362 Compare August 27, 2026 09:35
@knative-prow knative-prow Bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 27, 2026
@kahirokunn
kahirokunn force-pushed the feat/delivery-backoff-max branch from a63a362 to 31d966b Compare August 27, 2026 14:43
@knative-prow-robot knative-prow-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 27, 2026
@knative-prow knative-prow Bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Aug 27, 2026
@kahirokunn
kahirokunn marked this pull request as ready for review August 27, 2026 14:43
@knative-prow knative-prow Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 27, 2026
@kahirokunn
kahirokunn marked this pull request as draft August 27, 2026 15:22
@knative-prow knative-prow Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 27, 2026
@kahirokunn
kahirokunn force-pushed the feat/delivery-backoff-max branch from 31d966b to 823cbdb Compare August 27, 2026 16:23
@knative-prow knative-prow Bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 27, 2026
@kahirokunn
kahirokunn force-pushed the feat/delivery-backoff-max branch from 823cbdb to ed9c354 Compare August 28, 2026 04:07
Signed-off-by: kahirokunn <okinakahiro@gmail.com>
Signed-off-by: kahirokunn <okinakahiro@gmail.com>
Signed-off-by: kahirokunn <okinakahiro@gmail.com>
Signed-off-by: kahirokunn <okinakahiro@gmail.com>
Signed-off-by: kahirokunn <okinakahiro@gmail.com>
@kahirokunn
kahirokunn force-pushed the feat/delivery-backoff-max branch from ed9c354 to 63c3105 Compare August 28, 2026 04:24
@kahirokunn
kahirokunn marked this pull request as ready for review August 28, 2026 05:03
@knative-prow knative-prow Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 28, 2026
@knative-prow
knative-prow Bot requested a review from matzew August 28, 2026 05:03
@kahirokunn
kahirokunn force-pushed the feat/delivery-backoff-max branch 4 times, most recently from 22c29c6 to 05cd7b8 Compare August 28, 2026 07:22
@knative-prow knative-prow Bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Aug 28, 2026
@astelmashenko

Copy link
Copy Markdown
Member

@kahirokunn , AFAIK knative-eventing does not support DeliverySpec.backoffMax please check https://knative.dev/docs/eventing/reference/eventing-api/#duck.knative.dev/v1.DeliverySpec

@kahirokunn
kahirokunn force-pushed the feat/delivery-backoff-max branch from 05cd7b8 to 1d920b9 Compare August 28, 2026 08:26
Run the regular E2E suite against supported Kubernetes minors using the Kind setup from Eventing. Cover both the supported release and the revision selected by go.mod.

Signed-off-by: kahirokunn <okinakahiro@gmail.com>
Exercise BackoffMax and RetryAfterMax through both the NATS broker and channel in the experimental Eventing suite.

Signed-off-by: kahirokunn <okinakahiro@gmail.com>
@kahirokunn

Copy link
Copy Markdown
Member Author

@astelmashenko Thank you for your review 🙏
backoffMax is supported on Eventing main since knative/eventing#9279, and eventing-natss already depends on that merge commit via #804. It is an Alpha feature guarded by delivery-backoff-max, so it is not present in the currently published v1.23 API reference yet.
I would appreciate it if you could leave another review.

@kahirokunn

Copy link
Copy Markdown
Member Author

@Cali0707 Since you seem to have looked at my issue, I'll ping you! 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants