feat: make the webhook request timeout configurable - #885
Merged
Abd-Standard merged 2 commits intoOct 3, 2026
Merged
Conversation
|
@larondo1234 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! 🚀 |
Resolves merge conflicts against Core-Foundry/Notify-Chain@6d24241 (76 commit(s) behind) so the PR is mergeable.
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.
Overview
Makes the timeout for outbound webhook requests operator-configurable. Today the timeout that governs a webhook POST is hard-coded:
sendWebhook()falls back to5000ms while the live webhook delivery path (RetryScheduler→WebhookDeliveryService) silently uses10 000ms, and there is no way to tune it without editing code. This adds a validatedWEBHOOK_TIMEOUT_MSsetting with a behaviour-preserving default, wires it through the existingAbortControllerpath so the configured value actually governs the request, and surfaces a timeout as its own machine-readable failure reason — distinct from a generic network or HTTP failure.Related Issue
Fixes the gap described in #644.
Changes
[MODIFY]
listener/src/services/webhook-sender.tsWebhookFailureReasonandisWebhookTimeoutError(), a single place that recognises an aborted/timed-out webhook request (AbortError/TimeoutError) instead of every caller string-matchingerror.name.[MODIFY]
listener/src/services/webhook-delivery-service.tsDEFAULT_WEBHOOK_TIMEOUT_MS(10000, the timeout the live path already applied implicitly) andMAX_WEBHOOK_TIMEOUT_MS(300000).WebhookDeliveryResult.failureReason(timeout/network/http_retryable/http_permanent) so timeout failures are distinguishable programmatically, not only by message text.[MODIFY]
listener/src/services/webhook-retry-helper.tsclassifyWebhookFailure()and routesisRetryable()through it. Retry behaviour is unchanged, but a timeout is now a distinct reason rather than being folded into "some error".[MODIFY]
listener/src/services/retry-scheduler.tsRetrySchedulerConfig.webhookTimeoutMs(defaulting toDEFAULT_WEBHOOK_TIMEOUT_MS) and constructs the internalWebhookDeliveryServicewith the configured timeout, soWEBHOOK_TIMEOUT_MSreaches theAbortController.[MODIFY]
listener/src/types/index.ts,listener/src/config.ts,listener/src/config-schema.tsWEBHOOK_TIMEOUT_MSvia the existing integer parser (non-numeric values abort startup withConfigError), rejects< 1and> 300000invalidateConfig, and adds the field toAPP_CONFIG_SCHEMA.[MODIFY]
listener/.env.example,docs/LISTENER-CONFIGURATION.mdWEBHOOK_TIMEOUT_MS, its default, valid range, and the distinct timeout failure reason.[MODIFY]
listener/src/config.test.ts,listener/src/config-schema.test.ts,listener/src/services/webhook-delivery-service.test.ts,listener/src/services/webhook-retry-helper.test.ts,listener/src/services/retry-scheduler-webhook.test.tsAbortError/TimeoutErrorclassified astimeout, and the configured value governing a real (stubbed-fetch) request through the scheduler.Verification Results
listener/node_modulesis not installed and must not be installed (nojest/sqlite3native build), so verification executes the dependency-free parts with the workspacetsxagainst the real modules:Focused parse/type checks (run with the workspace
tsx/tsc; no installs):Pre-existing upstream breakage encountered while verifying (unrelated to this change, reproduced against
mainvia the GitHub API, and not modified here):listener/src/index.ts(syntax errors),listener/src/utils/request-id.ts(generateCorrelationIdunbalanced),listener/src/services/discord-notification.ts(sanitizeForDiscordunbalanced),listener/src/config.ts(validateSecretsnever imported),listener/src/config.test.ts(unclosed describe). TheRetrySchedulerharness was run against a work copy with a local-only repair ofrequest-id.ts's syntax so the module could load; that repair is not part of this PR.WEBHOOK_TIMEOUT_MS→RetrySchedulerConfig.webhookTimeoutMs→WebhookDeliveryService→sendWebhook→AbortControllerDEFAULT_WEBHOOK_TIMEOUT_MS = 10000, matching the timeout the live webhook path already appliedloadConfig;< 1or> 300000rejected byvalidateConfig+ schemafailureReason: "timeout"+ dedicatederrorReason, separate fromnetwork/http_retryable/http_permanentCloses #644