Backfill missed PR comments on worker startup (closes #794)#797
Merged
Conversation
When kennel is down, GitHub eventually gives up redelivering webhook events. Top-level PR comments landing during the downtime are then invisible to the worker loop on restart — fido never sees them, never replies. Add Worker.first_iteration mode: on the first iteration of each WorkerThread lifetime (i.e. after kennel restart), scan the active PR's issue_comments and enqueue thread tasks for any we haven't already tasked. create_task dedups by comment_id so replays are idempotent, and the scan runs exactly once per thread — zero steady-state cost. Scope is deliberately narrow: inline review comments and review threads are already scanned every iteration by handle_threads, so the gap is only top-level PR comments. Fresh PRs skip the scan since they have no history to backfill.
rhencke
approved these changes
Apr 18, 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.
Closes #794.
Summary
When kennel is down (vet-mode stop, crash, deploy), GitHub eventually stops retrying webhook delivery for the missed events. Top-level PR comments from that window are then invisible to the worker loop on restart — fido never sees them, never replies.
This PR adds a one-shot backfill pass that runs on the first iteration of each `WorkerThread` lifetime:
Scope
Top-level PR comments only. Inline review comments and review threads are already scanned every iteration by `Worker.handle_threads` — only issue-comments (`issue_comment` webhooks) are invisible to the loop.
Fresh PRs skip the scan (no history to backfill).
Test plan