Repository navigation
perf(control): Drop check_run/check_suite completed with no pull request in their own repo - #121719
Merged
vaind merged 5 commits intoAug 11, 2026
Conversation
…wn repo check_run.completed is the largest remaining line at the control parser -- 12.1M/day at ~110ms average in the cell handler -- and a third of it does no work when it lands. GitHub lists a PR on a check whenever they share a head sha, including PRs based in *other* repositories, and pr_metrics' _prs_from_check_payload resolves only entries whose base.repo is this webhook's repo. A payload carrying none of those is a guaranteed no-op there. Both sides of that comparison are in the payload, so control can make the call without the cell's database: the cell looks its Repository row up by external_id=str(event["repository"]["id"]), which is the same value the parser compares against. Measured at 31.7% of check_run.completed, ~3.6M requests/day (~4.1M rows after cell fan-out) against a peak-hour backlog surplus of 110-140K rows/h. check_suite is deliberately excluded despite carrying the same tag. Seer's pr_iteration_from_check_suite_listener also consumes completed, and it resolves runs by each entry's global pull_requests[].id without ever comparing base.repo -- a suite based entirely in another repo is still work for it. Encoded as ActionFilter.own_repo_pr_actions so the distinction lives next to the actions rather than in the parser. Unlike the existing parser drops this one keys off payload shape rather than a header, so it ships behind hybridcloud.webhookpayload.github_drop_checks_without _own_repo_pr, default off. The switch is only worth having if a wrong predicate is detectable, and it was not: _write_activity_row is a bare insert, so silently losing these events moved no counter anywhere. pr_metrics.check.activity_recorded is that signal -- it must stay flat when the option is enabled. drop_unprocessed_event also gains a reason tag so the new drop is separable from the two existing ones. Fixes CW-1838
The CHECK_SUITE comment claimed Seer's listener treats foreign-base pull requests as real work. It does read pull_requests[].id without comparing base.repo, but GitHub only attaches a PR to a suite on head_sha + head_branch, so a foreign-base entry is a PR with its head in this repo and its base elsewhere. Autofix opens both sides of a PR in one repo, so such an entry can never resolve one of its runs. check_suite stays out because its share of no-op deliveries is unmeasured, not because the predicate would be wrong there. Also drops the "10%" figure from _record_check_activity_metric: no sample_rate is passed, so the effective rate is deployment config and not something this docstring can state.
joseph-sentry
approved these changes
Aug 11, 2026
… own repo Measured at 3.73M of 9.87M/day (37.8%), roughly doubling what this option reclaims -- check_suite carries nearly check_run's volume, not a fraction of it, and a larger share of it does no work on arrival. Held back until now on the grounds that its second consumer, Seer's pr_iteration_from_check_suite_listener, resolved runs by each entry's global id without comparing base.repo. It compares as of #121724, so both consumers now skip entries based in another repo. They still part ways on the entry carrying no base.repo at all: pr_metrics skips it, Seer keeps it deliberately, since dropping one costs a real Autofix iteration. Reusing check_run's predicate here would drop those payloads on pr_metrics' stricter reading alone and lose that work, so ActionFilter gains unplaceable_pr_is_work and the predicate keeps them for check_suite. The drop stays a subset of every consumer's no-op set rather than the strictest one's. The has_own_repo_pr tag keeps the strict predicate so the series holds one meaning across event types and stays comparable with the measurement above. On check_suite it is therefore an upper bound: enabling the drop takes `false` to near zero, and the remainder is the unplaceable entries the drop preserves. Enabling the option is not safe until #121724 has merged and deployed.
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 32279c3. Configure here.
The entry carrying no base.repo needed special handling here only because the two check_suite consumers read it differently: pr_metrics skipped it, Seer's suite resolver kept it. #121724 aligns them on skipping, so the carve-out describes a disagreement that no longer exists. ActionFilter.unplaceable_pr_is_work and the predicate's `unplaceable_is_work` branch go with it, and check_suite now takes exactly check_run's rule. The has_own_repo_pr tag is unchanged and is no longer an upper bound on either event type, so `false` falls to zero for both once the option is enabled.
vaind
force-pushed
the
ivandlugos/cw-1838-drop-check-run-completed-without-own-repo-pr
branch
from
August 11, 2026 16:54
e9556ec to
40d0ea2
Compare
…without-own-repo-pr #121724 moved the own-repo predicate into integrations/github/check_payloads.py and deleted the parser's local copy, which this branch had edited. Took master's side: the local _references_own_repo_pull_request is gone and the drop calls the shared references_own_repo_pull_request, same as the has_own_repo_pr tag already does. The dependency this branch documented is now satisfied -- check_suite's second consumer resolves through the shared rule on master, so the option is safe to enable once this lands.
vaind
enabled auto-merge (squash)
August 11, 2026 18:57
vaind
deleted the
ivandlugos/cw-1838-drop-check-run-completed-without-own-repo-pr
branch
August 11, 2026 19:14
vaind
added a commit
that referenced
this pull request
Aug 24, 2026
Moves the rolled-out value of `hybridcloud.webhookpayload.github_drop_checks_without_own_repo_pr` into the registered default, so the automator can drop its temporary control-silo override ([options#9218](getsentry/sentry-options-automator#9218)). Baseline, not removal: the option stays registered and the parser keeps reading it, so setting it `false` is still the revert and needs no deploy. ### Why The drop ([#121719](#121719)) shipped off behind an option because its predicate reads payload shape rather than a header — if it were wrong, real check activity would silently stop being recorded. Two days on the control silo say it is right. Same-clock 11:58–12:55Z windows, which avoids attributing the European CI ramp to the change: | Signal | 08-13 vs 08-12 | 08-13 vs 08-11 (pre-toggle) | | --- | --- | --- | | `check.activity_recorded` check_run | +2.2% | metric did not exist | | `check.activity_recorded` check_suite | +1.8% | metric did not exist | | `forwarded_event` check_run `has_own_repo_pr:true` | +3.3% | +5.4% | | `forwarded_event` check_suite `has_own_repo_pr:true` | +2.3% | +0.8% | | `deliver_webhooks.saved` `provider:github` | +0.7% | **−18.3%** | The self-normalizing test — recorded activity over forwarded events, which cancels out traffic volume — never stepped at the cutover: check_run held 0.72–0.88 and check_suite 0.73–0.92 across 30 hours spanning the toggle. `has_own_repo_pr:false` has emitted nothing since 11:57Z on 08-12, one minute before these windows open. Net effect: roughly 18% fewer GitHub webhookpayload rows/day — about 14% of all rows, since GitHub is not the only provider writing them. ### Blast radius Control silo only. `IntegrationControlMiddleware._should_operate` returns early unless `SiloMode` is `CONTROL`, so region, single-tenant, and self-hosted deployments never reach this parser whatever the default says. The control silo already runs `true` via the automator, so no live behavior changes here — only where the value comes from. ### Tests Six tests depended on the old default: - The two `..._is_forwarded_by_default` tests become `..._is_dropped_by_default`, each gaining an explicit `option: False` counterpart covering the kill switch. - Three `forwarded_event` metric tests asserting `has_own_repo_pr:"false"` now pin the option off — with the drop on, that tag is unreachable. - `test_forwards_check_run_completed` / `test_forwards_check_suite_completed` now carry an own-repo PR, so they exercise the mailbox routing that production actually takes. `tests/sentry/middleware/integrations/` passes, 174 tests. ### Merge order Deploy this to all regions **before** merging [options#9218](getsentry/sentry-options-automator#9218). The other order drops the control-silo value while the deployed default is still `false`, reverting the drop for the length of the gap. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
This branch was successfully deployed
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.

Problem
check_run.completedandcheck_suite.completedare the two largest remaining lines at the control parser — 11.8M and 9.9M/day, the former at ~110ms average, roughly 370 CPU-hours/day in the cell handler alone — and about a third of each does no work when it lands.GitHub lists a PR on a check whenever the two share a head sha, which includes PRs based in other repositories. The cell's
_prs_from_check_payloadresolves only entries whosebase.repois this webhook's repo, so a payload carrying none of those resolves zero PRs and writes nothing. Today every one of them is still stored as aWebhookPayload, POSTed cross-silo, HMAC-verified, JSON-parsed, dispatched through the per-org handler loop, and republished to Kafka with its full body.Both sides of that comparison are in the payload, so control can make the call without the cell's database. The predicate is not an approximation of the cell's filter — it is the same comparison:
GitHubWebhook.__call__looks theRepositoryrow up byexternal_id=str(event["repository"]["id"]), which is exactly what the parser comparesbase.repo.idagainst.Measured over a full 24h window:
check_run.completedcheck_suite.completed~7.5M requests/day combined (~8.5M rows after the 1.13× cell fan-out), against a peak-hour backlog surplus of 110–140K rows/h.
Changes
The drop.
ActionFiltergainsown_repo_pr_actions— the actions where every cell-side consumer resolves PRs through the payload's own repo.references_own_repo_pull_requestwas already implemented in #121434 to tag the forwarded counter; it now decides.For
check_run.completedall three processors were re-checked:handle_preprod_check_run_eventreturns unlessrequested_action, code review'shandle_check_run_eventreturns unlessrerequested, and onlypr_metrics_handle_check_runreadspull_requests. The SCM stream'slisten_for_check_runis still a no-op stub.check_suite.completedhas a second consumer — Seer'spr_iteration_from_check_suite_listener, via the SCM stream — so the predicate rests on two filters there rather than one. Both resolve through the sharedis_own_repo_pull_requestas of #121724 (merged), which also fixed a foreign-base entry shadowing the own-repo one. Socheck_suitetakes exactlycheck_run's rule, with no carve-out, and the drop is a subset of both consumers' no-op sets.The kill switch. Unlike the existing parser drops, this one keys off payload shape rather than a header, so it ships behind
hybridcloud.webhookpayload.github_drop_checks_without_own_repo_pr, default off. As merged this is a strict no-op. One option covers both event types.The signal that makes the switch usable. A switch is only worth having if a wrong predicate is detectable, and it was not:
_write_activity_rowis a bare insert, so silently losing these events would move no counter anywhere and GitHub — already 202'd — never redelivers.pr_metrics.check.activity_recordedcloses that gap. It must stay flat when the option is enabled; any dip is the predicate being wrong, visible within the hour instead of never.drop_unprocessed_eventalso gains areasontag (unprocessed_event_type/unconsumed_action/no_own_repo_pr) so the new drop is separable from the two existing ones. The metric is in Datadog exclude-tags mode, so the tag indexes with no dashboard-side config.Rollout
Enable the option, then watch two things together, per event type:
The first should climb toward ~3.75M/day for
check_runand ~3.73M/day forcheck_suitewhile the second does not move.forwarded_event{action:completed,has_own_repo_pr:false}should fall to zero for both over the same window — the tag and the drop now use the same predicate, so there is no expected residual on either event type.The option is a rollout control, not a permanent feature — it should be removed once a week of flat activity volume confirms the predicate.
Risk
Most of the reclaimed volume is not the subtle case. The cell's
pr_metrics.check.foreign_pull_requestcounter — one increment per entry skipped for a non-matchingbase.repo— runs at 759K/day across both check event types, counting entries rather than payloads, and including payloads that also carried an own-repo entry and were processed normally. So at least ~79% of the drop is the emptypull_requests: []case: CI on a commit with no PR, where "the cell does nothing" isfor ref in (), not an inference about repo identity.One second-order effect, the same one #121434 called out for
check_suite:GitHubWebhook.__call__auto-creates missingRepositoryrows and callsupdate_repo_data()for any event carrying arepositorykey, independent of the processors, and dropped deliveries no longer trigger that. Safe for the same reason —push,pull_requestandissue_commentall still flow through that path.Minor observability change: code review's
record_webhook_received/record_webhook_filtered(UNSUPPORTED_ACTION)counters stop firing for droppedcheck_run.completed. No behavior attached.Fixes CW-1838