feat(infra): add github pr event feed #7403
main fromfeat/github-pr-event-feed·opened View on GitHubwhat changed#
- adds a standalone cloudflare worker at
infra/github-events - verifies github webhook hmac signatures and normalizes pull request, comment, review, check, workflow, and status events
- stores an ordered, deduplicated 512-event replay window in a per-repository sqlite durable object
- exposes an authenticated sse feed with sequence resume and optional pull request filtering
- documents deployment, github webhook setup, subscription, replay, security, and limits
why#
pr babysitters currently need to poll github independently, which wastes rate limit and duplicates work. this gives contributors one authenticated stream with the event content needed to react to pr activity.
verification#
vp fmt --check infra/github-events docs/operations/github-pr-event-feed.mdvp lint infra/github-eventsvp run --filter t3code-github-events typecheck- focused vitest suite: 27 tests passed
- local wrangler integration: signed webhooks returned 202, live sse emitted comment content, replay streamed sequences 1 through 10 in order, duplicate delivery emitted no second event, a sha-only status inherited pr 42 from the association index, a future cursor returned 409, invalid feed auth returned 401, and
/healthreturned 200
deployment#
not deployed from this pr. production setup needs cloudflare credentials plus fresh webhook and feed secrets, followed by the github repository webhook configuration documented in docs/operations/github-pr-event-feed.md.
checklist#
- this pr is focused on one deployable service
- behavior and operational setup are documented
- security, replay, normalization, and subscription paths are tested
request provenance#
- requested by: @saphid
Note
Medium Risk New internet-facing webhook and token-authenticated SSE surface with HMAC verification and fail-closed config, but mishandling could leak or drop PR automation events; deployment and secret rotation are operational dependencies.
Overview
Adds a new infra/github-events Cloudflare Worker so PR babysitters can subscribe to GitHub activity instead of polling the API.
The worker accepts signed webhooks at /v1/github/webhook, normalizes PR-related deliveries (comments, reviews, checks, workflows, statuses), and forwards them to a per-repo GitHubEventHub Durable Object. The hub stores an ordered replay window (512 events), deduplicates deliveries (10k ids), enriches SHA-only CI/status events from a head-sha→PR index, and streams github SSE messages from /v1/repos/{owner}/{repo}/events with bearer auth, optional pull filtering, and resume via Last-Event-ID / after (including 410 / 409 cursor errors).
docs/operations/github-pr-event-feed.md documents deploy secrets, GitHub webhook setup, subscription examples, event envelope, and security limits. Alchemy wiring lives in alchemy.run.ts; behavior is covered by unit tests across normalization, signatures, HTTP handling, event log, and SSE formatting.
Note
Add GitHub PR event feed service as a Cloudflare Worker with SSE streaming#
- Adds a new Cloudflare Worker at infra/github-events that receives GitHub webhook deliveries, normalizes them, and fans them out to subscribers via Server-Sent Events.
- The
GitHubEventHubDurable Object persists events in SQLite, deduplicates by delivery ID, maintains a rolling retention window, and streams retained+live events to SSE consumers with optional PR-number filtering and cursor-based resume. POST /v1/github/webhookverifies HMAC-SHA256 signatures, enforces a 512 KiB / 10-second body limit, normalizes eight GitHub webhook event types into a canonical envelope, and restricts to a configured repository allowlist.GET /v1/repos/:owner/:repo/eventsserves SSE with bearer token auth, returning 410 when the resume cursor has expired beyond the retention window.- Risk: subscriber count is capped (
MAX_SUBSCRIBERS) and PR-head association memory is bounded; overflow drops connections silently.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XXL
Approvability#
Verdict: Not approved
Macroscope's review found this PR not approvable — This PR introduces a new Cloudflare Worker service with production deployment, webhook signature verification, and bearer token authentication. New infrastructure capabilities with security-sensitive operations warrant human review.
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).Note
🤖 GPT-5.6 Sol responding on behalf of Theo
We're closing this PR as we clean up the T3 Code backlog. Thank you for taking the time to put this together.
This adds a separate GitHub webhook, Durable Object event log, SSE service, deployment workflow, and operations runbook. T3 Code does not need a second pull-request event service for its current operation.
If you believe we closed this in error, please reopen the PR and leave a comment explaining what we missed.
t3dotgg(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.
Thread transfer impact#
✅ Thread transfer remains within every enforced ceiling.
Baseline:
82b8a93· PR result:2c46d3c· Source CI: successScenario and decoded snapshot size
10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.