Skip to content

feat(webhooks): classify delivery responses as success, retryable, or permanent (#643) - #887

Open
Goodyslim wants to merge 1 commit into
Core-Foundry:mainfrom
Goodyslim:feat/643-classify-webhook-responses
Open

Goodyslim wants to merge 1 commit into
Core-Foundry:mainfrom
Goodyslim:feat/643-classify-webhook-responses

Conversation

@Goodyslim

Copy link
Copy Markdown

Closes #643.

What

Introduces a single, documented classifier for webhook delivery responses and routes both delivery paths through it.

Categories

Category HTTP Retried
success 2xx No
retryable 429, any 5xx, network/timeout errors Yes (bounded)
permanent 3xx, other 4xx, 1xx No

Changes

  • New listener/src/services/webhook-response-classifier.ts - classifyWebhookStatus, classifyWebhookError, isRetryableStatus, plus exported status-code sets. Unrecognised outcomes default to permanent so a bug can only under-retry, never loop.
  • webhook-delivery-service.ts - WebhookDeliveryResult now carries a category; logging keys off it (5xx keeps its existing warn message; 429 is now correctly retryable).
  • webhook-retry-helper.ts - isRetryable delegates to the classifier (existing 4xx/5xx matrix preserved).
  • New listener/docs/WEBHOOK_RESPONSE_CLASSIFICATION.md documenting the rules.

Tests

  • New webhook-response-classifier.test.ts covers representative codes per category and the error classifier.
  • webhook-delivery-service.test.ts gains category assertions for 2xx, 429/5xx, 4xx, timeouts, and network errors. Existing delivery/retry tests are unchanged.

… permanent (Core-Foundry#643)

Webhook retry decisions were spread across two modules with slightly
different rules. This introduces one canonical classifier and routes both
the delivery service and the bounded retry helper through it.

- Add webhook-response-classifier.ts: 2xx -> success; 429 and any 5xx ->
  retryable; redirects/other 4xx/1xx -> permanent; network/timeout errors ->
  retryable. Unrecognised outcomes default to permanent (never loop forever).
- webhook-delivery-service now reports a 'category' on WebhookDeliveryResult
  and logs retryable vs permanent failures accordingly.
- webhook-retry-helper delegates isRetryable to the classifier (behaviour
  preserved for the existing status-code matrix).
- Document the rules in listener/docs/WEBHOOK_RESPONSE_CLASSIFICATION.md.
- Add classifier tests plus category assertions in the delivery tests.
@drips-wave

drips-wave Bot commented Sep 29, 2026

Copy link
Copy Markdown

@Goodyslim Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Classify Webhook Delivery Responses

1 participant