Skip to content

fix(service): alert when GitHub cannot deliver a webhook - #5045

Merged
dan-petty merged 2 commits into
mainfrom
fix/5017-webhook-403
Nov 12, 2026
Merged

dan-petty merged 2 commits into
mainfrom
fix/5017-webhook-403

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

Cloudflare Access refuses part of the webhook deliveries of GitHub with HTTP 403 at the edge: its Bypass policy lacks 3 of the 9 hook ranges of api.github.com/meta. The webhook route never sees such a refusal. Only the owner changes an Access policy (decision O3), so this change does not change it. The metrics row now reads the newest deliveries of each active hook and sets devops_cli_service_webhook_delivery_failures by repo and code. Each installation token also asks for repository_hooks: read. RoadmapServiceWebhookDeliveriesFailed warns at more than 5 failed deliveries of one repository in 15 minutes.

Closes #5017

Change: openspec/changes/archive/2026-11-12-5017-find-why-webhook-deliveries-get-http/

@dan-petty dan-petty added type/bug Type bug: the code does not do what it must scope/service The long-running devops Service and its lanes labels Nov 12, 2026
@dan-petty

Copy link
Copy Markdown
Owner Author

Evidence

Premise. The comment on #5017 holds the read-only evidence: Cloudflare Access answers the 403 (Cf-Access-Aud header, page Error ・ Cloudflare Access). The Bypass policy gh-hooks-public-ips of hooks.<domain>/webhooks/github does not hold 9.234.98.160/28, 9.234.98.176/28 and 9.234.106.48/28 of uv run devops gh api meta --jq .hooks. No file of the repository holds the policy. The edge change is owner decision O3. This pull request adds only the check (steps 3 and 4 of the issue).

Before the merge, the owner checks:

  • The installation of devops-cli-service grants Webhooks (read). Each token now asks for repository_hooks: read. If the installation does not grant it, GitHub refuses each token with HTTP 422, and the Service and the runner Jobs get no token. ADR 0015 says that the App has read and write on every repository permission.
  • This pull request changes Service code, so it waits for the owner's "safe and vetted" call.

Runs (2026-11-12, worktree on origin/main 87ae9ee):

  • uv run devops ci fail-to-pass --base origin/main: 3 failed on base (the token permission tests); the new modules tests/github/test_hook_deliveries.py, tests/roadmap/test_roadmap_run_metrics.py, tests/prometheus/test_k8s_monitoring_alerting.py and tests/telemetry/test_telemetry_instruments.py do not collect on base (the new constants are missing).
  • uv run devops ci --check --only lint,format,docs,constructs,openspec,test-tree: all pass.
  • uv run pytest -n 4 over the 13 test files that use GitHubFake, the new tests, the App identity, status rows, checkout, instrument and alerting tests: 641 passed. Due table, lanes, Service and tests/server: 224 passed.
  • promtool test rules (the pinned promtool, through test_each_unit_tested_rule_fires_on_a_sample_and_stays_quiet_on_a_normal_series[roadmap_service_webhooks_tests]): passed. promtool check rules: passed.
  • uv run mypy on the changed source files: no error in them.

After the deploy: the Service log line GitHub App devops-cli-service[bot] has a new installation token with these permissions: names repository_hooks, and devops_cli_service_webhook_delivery_failures{code="403"} shows the edge refusals until the owner changes the policy.

Cloudflare Access at the edge refused 39 of the 100 newest deliveries of
the repository hook with HTTP 403. The refusal never gets to the webhook
route, so RoadmapServiceWebhooksRejected cannot see it. The cause is an
Access policy, which only the owner changes (decision O3); the evidence
is on #5017.

The metrics row now reads the active hooks of its repository and the
newest 100 deliveries of each one, and sets the gauge
devops_cli_service_webhook_delivery_failures by repo and code to the
deliveries of the last 15 minutes with no 2xx answer. Each installation
token asks for repository_hooks: read for this read. The alert
RoadmapServiceWebhookDeliveriesFailed warns at more than 5 failed
deliveries of one repository.
@dan-petty
dan-petty force-pushed the fix/5017-webhook-403 branch from 0c588c6 to 23fa418 Compare November 12, 2026 11:55
@dan-petty
dan-petty marked this pull request as ready for review November 12, 2026 12:02
@dan-petty

Copy link
Copy Markdown
Owner Author

Second push (23fa418)

The first run failed one test on shard 1: tests/grafana/test_grafana_dashboards.py::test_cli_dashboard_service_row_reads_each_series_of_the_service. Each CONST_SERVICE_METRIC_ series must have a query in the row "Roadmap Service" of the devops-cli dashboard. The second push adds the panel "Service Failed Webhook Deliveries" (max by (repo, code) (last_over_time(devops_cli_service_webhook_delivery_failures{job=~"$job"}[5m]))) at the free place of the row. Its panel ID is 60, because #4966 adds the IDs 55-59.

Local run: uv run pytest -n 4 tests/grafana tests/telemetry/test_telemetry_instruments.py: 147 passed. CI on 23fa418: 22 checks passed and 3 skipped, Static Analysis, Tests & Coverage and Semantic PR title included.

The pull request changes Service code, so it waits for the owner's "safe and vetted" call. Before the merge, check that the installation of devops-cli-service grants Webhooks (read) (first comment).

@dan-petty
dan-petty merged commit 2bfbfcb into main Nov 12, 2026
25 checks passed
@dan-petty
dan-petty deleted the fix/5017-webhook-403 branch November 12, 2026 12:13
dan-petty pushed a commit that referenced this pull request Nov 12, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.118.0](v0.117.2...v0.118.0)
(2026-11-12)


### Features

* **ci:** devops ci stops its rows when timeout ends it
([#5031](#5031))
([1fa4e9c](1fa4e9c))
* **roadmap:** keep the stage gate problems as a list with a code
([#5022](#5022))
([5819627](5819627))
* **roadmap:** log one result line for each roadmap job attempt
([#4966](#4966))
([2b6fe3f](2b6fe3f))
* **telemetry:** record each CLI usage error by name and kind
([#4973](#4973))
([a179fd9](a179fd9))


### Bug Fixes

* **ai:** chat loads each persona prompt and challenger gets tools
([#5037](#5037))
([c40b0ad](c40b0ad))
* **ai:** keep the HTTP status of a Claude reply after retries
([#4976](#4976))
([5bf9466](5bf9466))
* **deps:** keep Renovate uv bumps green and groups on Monday
([#4987](#4987))
([b19e153](b19e153))
* **k8s:** raise the limits that 7 d of use shows are too low
([#5030](#5030))
([028c62b](028c62b))
* **roadmap:** a job posts no comment that repeats a recent one
([#4978](#4978))
([fff903a](fff903a))
* **service:** alert when GitHub cannot deliver a webhook
([#5045](#5045))
([2bfbfcb](2bfbfcb))
* **service:** delete the stream route that sends canned verified text
([#5038](#5038))
([e9d51b5](e9d51b5))
* **telemetry:** keep one upstream status series per service
([#4986](#4986))
([3e4ca56](3e4ca56))
* **tests:** remove the runner variable in the test floor
([#4988](#4988))
([093aa61](093aa61))


### Performance Improvements

* **ai:** make the ast graph walk and call search faster
([#5039](#5039))
([3b25cc6](3b25cc6)),
closes [#4662](#4662)
* **ci:** build the devcontainer only on its own inputs
([#4977](#4977))
([c5b15ac](c5b15ac))
* **ci:** test each merge once, on the push to main
([#5043](#5043))
([c6992b1](c6992b1))
* **tests:** remove fixed waste in six slow tests
([#4995](#4995))
([1c7044e](1c7044e))


### Code Refactoring

* **ai:** delete devops ai pipeline and persona leftovers
([#5044](#5044))
([d5fefde](d5fefde)),
closes [#4827](#4827)
* **openspec:** split big capabilities into nested ones
([#4981](#4981))
([dfb09bd](dfb09bd))
* **pr:** devops pr update acts only on a failed check
([#4990](#4990))
([aa4fa1a](aa4fa1a))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/service The long-running devops Service and its lanes type/bug Type bug: the code does not do what it must

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(service): find why webhook deliveries get HTTP 403

1 participant