Fit a webhook payload whose top-level fields alone exceed the cap, instead of looping forever - #707
Merged
davidmckayv merged 3 commits intoOct 2, 2026
Conversation
fitPayload kept every top-level scalar (up to 1000 chars each) and then trimmed the excerpt until the whole fit in 32 KiB. When the scalars alone exceeded that, the excerpt reached "" and the loop never ended, blocking the event loop. Give the kept scalars half the cap.
Chebaleomkar
requested review from
MikeRyanDev,
davidmckayv,
guidovizoso,
mxmzb and
tylerslaton
as code owners
October 2, 2026 19:04
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.
What this changes
fitPayload(server/src/responsibilities/triggers.ts) keeps every top-level scalar of an oversized trigger payload, each cut to 1000 characters, then trimsexcerptby 1024 characters per pass until the whole fits in 32 KiB. When the scalars alone exceed 32 KiB (for example a flat webhook body with forty 1000-character fields, about 40 KB and well under the 256 KiB body limit),excerptreaches"","".slice(0, -1024)stays"", and thewhilenever ends. It runs synchronously, so the server stops answering every request.The kept scalars now get at most half the cap. Fields past that are left out of the top level and remain in the excerpt.
Where it runs
Server: generic and provider webhook triggers (
trigger-routes.tscallsfitPayloadbefore recording the event).Boundary and audit
No change to signature checks or to what is recorded, apart from which scalars are hoisted.
Changelog
Entry under Unreleased.
Proof
New case in
server/tests/responsibility-triggers.test.ts. Onmainit never returns (killed bytimeout 60, exit 124). With the fix the file passes 28/28. Biome format and lint are clean.