fix(webhook): don't retain failed PR metadata jobs#118
Merged
Conversation
A `fetch-pr-metadata` job uses a stable custom jobId per PR (`meta-<repo>-<pr>`). BullMQ ignores `add()` when a job with that id already exists in any state, including the failed-retention set. With `removeOnFail: 50`, a metadata job that exhausts its 3 retries during a transient GitHub outage sat in the failed set and blocked every later `edited`/`closed`/`reopened`/`synchronize` webhook for the same PR until the global 50-slot cap evicted it — leaving `body`, `last_edited_at`, `closing_issue_numbers`, and downstream `issues.solved_by_pr` stale. Drop retention for these enqueues to `true` so failed jobs evict immediately and the next webhook gets a fresh fetch. Failure detail remains in service logs. Fixes #75.
entrius
approved these changes
May 20, 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
fetch-pr-metadatajob uses a stable custom jobId per PR (meta-<repo>-<pr>). BullMQ ignoresadd()when a job with that id already exists in any state, including failed retention.removeOnFail: 50, a metadata job that exhausted its 3 retries during a transient GitHub outage sat in the failed set and blocked every lateredited/closed/reopened/synchronizewebhook for the same PR until the global 50-slot cap evicted it — leavingbody,last_edited_at,closing_issue_numbers, and downstreamissues.solved_by_prstale.trueso failed jobs evict immediately and the next webhook gets a fresh fetch. Failure detail remains in service logs.Fixes #75. PR_FILES enqueues are unaffected — their jobId already varies by head/base SHA, so a failed entry can't squat across pushes.
Test plan
npm run format:checknpm run lintnpm run build