perf(webhook): give every coalesce family the quiet window its key needs - #10133
Merged
Conversation
githubWebhookCoalesceKey computes a job coalesce key for five event families. githubWebhookCoalesceDelaySeconds returned a non-zero window for exactly one of them, the push family, and 0 for the rest -- and a zero-delay job is claimed off the queue before a sibling can arrive, so there is no pending row to merge into. The file already says as much in its push section; that reasoning was never extended to the other four, leaving their keys derived, attached, and structurally unable to do anything. On the Orb: 1,727 check_suite.completed deliveries in a day and a half, and 2.94 decision records per distinct head SHA -- nearly three full gate passes over state that had not changed. The LLM review is not duplicated (415 ai_review_pr calls against 519 heads, so the per-head cache holds); the waste is GitHub quota, queue churn and ledger writes, which is why a healthy cost line hid it. The key and the window now come from one classifier returning both, so a family cannot have one without the other. Windows: 45s for CI completion (under the 60s downstream per-PR throttle, which stays the outer bound), 15s for label and review-surface bursts, and deliberately 0 for the lifecycle family -- opened/reopened/ready_for_review each happen once and start the clock a contributor is waiting on, and at 203 opened deliveries against 1,727 CI completions they are not a burst source anyway. The invariant is asserted as "key implies window" over the real families rather than as expected constants, so a family added later cannot quietly reintroduce a keyed-but-inert delivery. Closes #10127
Contributor
|
Important 🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨 ⏳ LoopOver is waiting…LoopOver has seen this pull request and is waiting on CI checks to finish before reviewing it. This comment will update once the review runs. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed · 🟨 Waiting |
Contributor
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #10133 +/- ##
==========================================
- Coverage 91.96% 91.09% -0.88%
==========================================
Files 931 931
Lines 113966 113972 +6
Branches 27513 27514 +1
==========================================
- Hits 104808 103820 -988
- Misses 7858 9047 +1189
+ Partials 1300 1105 -195
Flags with carried forward coverage won't be shown. Click here to find out more.
|
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 #10127
githubWebhookCoalesceKeycomputes a job coalesce key for five event families.githubWebhookCoalesceDelaySecondsreturned a non-zero window for exactly one of them — the push family (#9479) — and0for the rest. A zero-delay job is claimed off the queue before a sibling can arrive, so there is no pending row to merge into.The file already says this, in the push section:
That reasoning was never extended to the other four. Their keys were derived, attached to the job, and structurally unable to do anything.
Measured on the Orb, not projected
Nearly three full gate passes per distinct head SHA. Worked example — #10098, eleven
holdrecords at one head SHA in 33 minutes, every oneupstream_state_change.The LLM review is not duplicated.
ai_review_prshows 415 calls against 519 distinct heads, so the per-head review cache is holding. The waste is GitHub REST/GraphQL quota, queue churn,decision_recordswrites, and label/comment reconciliation — which is exactly why it went unnoticed: the cost line looked fine.The change
The key and its window now come from one classifier, so a family cannot have one without the other:
Both exported functions become projections of it. That coupling is the actual fix — the numbers below are tuning.
pr-pushci-completedCI_COALESCE_WINDOW_SECONDS(60s) so the downstream per-PR throttle stays the outer boundpr-labelpr-refreshopened/reopened/ready_for_revieweach happen once and start the clock a contributor waits on. Keyed so a same-instant duplicate still collapses, never delayedLifecycle keeping a zero window is deliberate. Delaying a PR's first verdict to save a redelivery trades a real cost for an imaginary one: 203
openeddeliveries against 1,727 CI completions in the same period — lifecycle is not a burst source.Verification
check-*sweep green.dead-exports:check(correctly) objected to exporting them.What I am not claiming
How much this actually collapses depends on how CI suites cluster in time, which I cannot predict from here. Baseline is captured (
2.944records/head at 2026-07-31T08:14:58Z); I will re-measure on the Orb after the deploy and report the real figure rather than a projection.Separately checked and found already handled, so deliberately not touched: the 2,064
issue_commentdeliveries are the bot's own comment churn, andisSelfAuthoredAppCommentWebhook/isBotAuthoredIssueCommentEditWebhookalready drop them at ingest before any gate pass.