Skip to content

feat(api,cli): check GitHub App webhook event subscriptions#324

Merged
Zach Dunn (zachdunn) merged 1 commit into
mainfrom
feat/doctor-webhook-event-subscriptions
Jul 21, 2026
Merged

feat(api,cli): check GitHub App webhook event subscriptions#324
Zach Dunn (zachdunn) merged 1 commit into
mainfrom
feat/doctor-webhook-event-subscriptions

Conversation

@zachdunn

Copy link
Copy Markdown
Member

Summary

  • The GitHub App can ship with a green ping while issues/pull_request are never ticked under Settings → Permissions & events → Subscribe to events — silently disabling webhook auto-promotion (feat(api): GitHub webhooks for phase-1 title-cache invalidation (phase 2 PR A) #288) and title-cache invalidation, with nothing that surfaces the gap.
  • Adds GET /v1/:workspace/github/health: uses the App JWT to call GET /app (which returns the App's subscribed events), and compares against the required list (issues, pull_request — the events handleWebhook actually reads).
  • Adds uploads github doctor, a CLI check against that endpoint, reporting missing subscriptions and a pointer to Settings → Permissions & events → Subscribe to events.
  • Documents the required subscription list on the GitHub App docs page (apps/web/src/pages/docs/github-app.astro, Permissions section).

Where the check lives

  • Server-side: apps/api/src/github-app.ts (appEventSubscriptions, REQUIRED_WEBHOOK_EVENTS), wired into apps/api/src/routes/github-health.ts, mounted at /v1/:workspace/github/health (same auth pattern as /github/link).
  • CLI-side: packages/uploads/src/client.ts (githubHealth()), packages/uploads/src/commands.ts (runGithub gains a doctor subaction), packages/uploads/src/cli-catalog.ts (help catalog entry).

Required events enforced

issues, pull_request — the two event types handleWebhook (apps/api/src/github-webhook.ts) reads for title invalidation and pull-request auto-promotion. (installation/installation_repositories/ping are always sent by GitHub regardless of subscription, so they're not part of the required list.)

Test plan

  • pnpm test — 1945 tests pass across the monorepo (apps/api, packages/uploads, apps/web, apps/auth, apps/mcp, packages/errors/email/storage)
  • pnpm run typecheck — clean
  • New tests: apps/api/src/github-app.test.ts (appEventSubscriptions unit tests), apps/api/src/routes/github-health-route.test.ts (route: not-configured, ok, missing-events, upstream-failure, 401), packages/uploads/test/commands-github-doctor.test.ts (CLI: ok/missing/not-configured/--json/404-degrade)

Addresses the webhook-subscription follow-up on #293 (leaving the issue open — it also covers phases beyond this).

The App can ship with a green ping while issues/pull_request are never
ticked under Settings -> Permissions & events -> Subscribe to events,
silently disabling webhook auto-promotion and title-cache invalidation.
Adds GET /v1/:workspace/github/health (App JWT -> GET /app -> compare
events) and `uploads github doctor` to surface that gap instead of
requiring someone to notice via /app/hook/deliveries.
@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are limited based on label configuration.

🏷️ Required labels (at least one) (2)
  • coderabbit:review
  • review
🚫 Excluded labels (none allowed) (1)
  • wip

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: eeb9c036-ff5c-43aa-9b5f-b2155efc5320

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/doctor-webhook-event-subscriptions

Comment @coderabbitai help to get the list of available commands.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
uploads-api 6fce253 Commit Preview URL

Branch Preview URL
Jul 21 2026, 10:38 AM

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
uploads-auth 6fce253 Commit Preview URL

Branch Preview URL
Jul 21 2026, 10:38 AM

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
uploads-web 6fce253 Commit Preview URL

Branch Preview URL
Jul 21 2026, 10:38 AM

@zachdunn
Zach Dunn (zachdunn) merged commit 87f5626 into main Jul 21, 2026
6 checks passed
@zachdunn
Zach Dunn (zachdunn) deleted the feat/doctor-webhook-event-subscriptions branch July 21, 2026 10:40
Zach Dunn (zachdunn) added a commit that referenced this pull request Jul 21, 2026
…eal (#334)

github-app.astro accreted separate notes across #324/#332 for the doctor
health-check and the recommended issue_comment subscription; restructure it
into one coherent page: permissions vs events (required vs recommended,
doctor as the verification tool), a new repo-bindings section (first-claim-
wins, unlink, admin reassign, and reassurance that other workspaces can't
post to your repo), a dedicated self-healing-comments section, and a short
newcomer orientation for readers arriving from the bot comment's docs link
who have never seen the CLI.

Both agent skills covered stage-as-you-go branch staging in #322 but predate
unlink, doctor, and the not_authorized cross-tenant decline (#325/#327):
add the remedy path (link --status, then unlink or ask an operator), doctor
as the health check, what not_authorized means (no gh fallback), and that
the bot comment self-heals so agents don't panic-repost when it briefly
disappears.
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.

1 participant