All projects
Case Study — 005

Bugbot

Built, server + worker monorepo

A GitHub App that reviews your pull requests with inline LLM comments. Webhook in, review out.

ms
Webhook ack
3× backoff
Retries
2 + 2
Apps + packages
gpt-4.1-mini
Model
// Overview

When a PR opens or updates, GitHub sends a webhook to the Bugbot server. The server validates the signature, enqueues a review job, and responds in milliseconds. A background worker then picks up the job, fetches the PR diff, runs an LLM analysis pipeline, and posts inline review comments directly on the PR.

The system is a TypeScript monorepo with two runnable apps (server and worker) and two shared packages (config and db), built for resilience: retries with backoff, per-chunk error isolation, token caps, and comment deduplication.

// Key Features
01

Millisecond webhooks

The Hono server verifies the HMAC signature, upserts a ReviewJob, enqueues to BullMQ, and acks GitHub in milliseconds. All heavy lifting is deferred.

02

Token-bounded chunking

Large diffs are split into model-sized chunks with global token caps, keeping OpenAI costs predictable on monster PRs.

03

Inline review comments

Findings are posted as file/line-anchored PR review comments through the GitHub App installation client.

04

Resilient by default

Exponential backoff with up to 3 retries per job, and per-chunk error isolation so one bad diff never sinks a review.

05

No duplicate noise

Existing PR comments get fetched before posting, so re-pushes never re-report the same issue.

// How It Works
  1. 01

    GitHub App webhook → Hono server, HMAC signature verified

  2. 02

    ReviewJob upserted via Prisma 7 (PostgreSQL 16) and enqueued to BullMQ on Redis

  3. 03

    The worker fetches PR files through the installation-scoped Octokit client

  4. 04

    Diff → token-bounded chunks → gpt-4.1-mini analysis via the Responses API

  5. 05

    Findings post as a single inline review; totals are exposed at GET /stats

// Stack
TypeScriptnpm workspacesHonoBullMQioredisPrisma 7PostgreSQL 16OctokitOpenAI SDKpinoDocker Compose