feat(webhooks): accepted PR events ride the durable signal queue - #614
Merged
Conversation
Closes the last lossy event path: a crash between the webhook 202 and the review session spawning no longer loses the PR event. - The filter chain (signature, action, draft, allowlist, dedup, cap) stays inline — response semantics unchanged. On acceptance the handler enqueues a pr-review signal (deduped on the existing idempotency key, 1h TTL) instead of fire-and-forgetting processPrReviewAsync - processQueuedPrReview consumes from the queue: redelivery-safe via the pre-allocated session id (existing session = spawn already happened), malformed signals dropped with a log, transient failures rethrown so the queue retries them (3 attempts) - Publisher injected by ws-server; without one (tests, engine down or enqueue failure) the legacy inline path runs unchanged Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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
The last follow-up from the durable-signals work (#605): accepted PR webhook events now flow through the at-least-once queue, so a crash between the 202 response and the review session spawning delays the review instead of losing it.
Design — surgical, not a rewrite
pr-reviewsignal — deduped on the existing PR idempotency key, 1 h TTL — carrying the payload, event record, and the pre-allocated session id.processQueuedPrReviewconsumes it with three explicit outcomes: existing session → no-op (redelivery after a mid-spawn crash), malformed payload → dropped with a log (retry can't fix it), transient failure (gh hiccup before any session exists) → rethrown so the queue retries (3 attempts, then ledgered as failed).Testing
4 new tests: enqueue-on-accept (with dedupe key + no inline spawn), publisher-failure fallback, redelivery no-op, malformed-signal drop. Full suite: 3070 pass; build + lint clean.
🤖 Generated with Claude Code