Skip to content

fix: skip VCS webhook repositories whose function or site was deleted - #13793

Merged
ChiragAgg5k merged 3 commits into
mainfrom
fix-vcs-webhook-deleted-resource
Sep 21, 2026
Merged

ChiragAgg5k merged 3 commits into
mainfrom
fix-vcs-webhook-deleted-resource

Conversation

@ChiragAgg5k

@ChiragAgg5k ChiragAgg5k commented Sep 21, 2026 •

Copy link
Copy Markdown
Member

What does this PR do?

POST /v1/vcs/github/events resolves each linked repository's function or site before creating a deployment. When the resource was deleted but the deletes worker has not yet removed the repository row, the lookup returns an empty document and the deployments query runs with a null resourceInternalId, failing the whole webhook with a 500 Invalid query. Fixes Sentry CLOUD-3QWM, 1.4k events since 9/5. Such repositories are now skipped, the same way non-matching branches are, and the remaining repositories in the payload are still processed.

Test Plan

New E2E testGitHubPushForDeletedFunctionIsSkipped in VCSGitHubConsoleClientTest creates a VCS-linked function, deletes it and sends the push webhook, asserting 200. Runs in the VCS GitHub CI job, which has the GitHub app credentials.

Checklist

The deletes worker removes the repository row after the resource, so a push arriving in between resolves an empty resource, queries deployments by a null sequence and fails the whole webhook with a 500 (Sentry CLOUD-3QWM). Skip that repository and keep handling the rest.
@greptile-apps

greptile-apps Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The PR appears safe to merge; the stale-resource guard prevents the reported invalid query, and the replacement E2E test exercises the public webhook behavior.

Summary

This PR prevents GitHub push webhooks from failing when a linked function or site has already been deleted but its repository record still exists.

  • Skips stale repository links before querying deployments with a missing resource sequence.
  • Records the skip reason on the request span.
  • Replaces the previously criticized HTTP-layer unit test with an E2E webhook regression test that asserts the request succeeds after deleting the linked function.

Reviews (3) · Last reviewed commit: "refactor: drop redundant warning, the sp..."

@github-actions

github-actions Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

✨ Benchmark results

Comparing main (before) → fix-vcs-webhook-deleted-resource (after).

Metric Before After Change
🚀 Requests/sec 199.65 203.61 ⚪ +2%
⏱️ Latency P50 85.32 ms 85.11 ms ⚪ -0.2%
⏱️ Latency P95 204.24 ms 201.31 ms ⚪ -1.4%
Per-scenario breakdown & investigation details

Metrics below reflect the current branch (after). Δ P95 compares against the base.

Scenario P50 (ms) P95 (ms) Requests RPS Δ P95 (ms)
API total 85.11 201.31 12,654 203.61 -2.93
Account 159.65 317.24 666 11.09 -6.12
TablesDB 81.94 154.5 6,882 112.37 +3.9
Storage 80.4 177.23 3,330 56.51 +5.65
Functions 124.22 237.67 1,776 30.82 -64.88

Top API waits (after)

API request Max wait (ms)
account.name.update 480.83
functions.variables.update 396.2
account.prefs.update 373.45
storage.buckets.create 357.5
functions.delete 342.53

@ChiragAgg5k
ChiragAgg5k merged commit 7384f7e into main Sep 21, 2026
50 checks passed
@ChiragAgg5k
ChiragAgg5k deleted the fix-vcs-webhook-deleted-resource branch September 21, 2026 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants