No description
  • Go 94.4%
  • HTML 5.4%
  • Dockerfile 0.2%
Find a file
Charley Sheets 25eca4cf75
All checks were successful
Build and push to Harbor / build-push (push) Successful in 2m19s
Merge pull request 'fix(reviewer): suggest @bot retry in the failure comment' (#66) from feat/retry-suggestion-on-failure into main
Reviewed-on: #66
2026-05-30 11:51:46 +00:00
.forgejo/workflows doc: annotate fixtures cron with the human-readable time 2026-05-06 06:46:16 +00:00
cmd feat(comments): link tracking id to dashboard review page 2026-05-02 01:09:55 -07:00
internal fix(reviewer): suggest @bot retry in the failure comment 2026-05-29 23:54:45 -07:00
.gitignore feat: scaffold Go rewrite — config, tracker parity, two-binary skeleton 2026-04-17 06:28:06 +00:00
CLAUDE.md refactor: remove dead Python implementation, update docs for Go layout 2026-05-02 01:15:32 -07:00
Dockerfile feat: cut over image from Python to Go 2026-04-18 01:35:48 +00:00
go.mod feat: dashboard rewrite with OIDC, user reviews, ratings, admin UI (Phase D) 2026-04-17 23:38:19 +00:00
go.sum feat: dashboard rewrite with OIDC, user reviews, ratings, admin UI (Phase D) 2026-04-17 23:38:19 +00:00
README.md refactor: remove dead Python implementation, update docs for Go layout 2026-05-02 01:15:32 -07:00
TODO.md doc: add TODO with planned features 2026-03-21 19:42:54 +00:00
VERSION fix: honor a VERSION floor when no git tags exist 2026-04-18 01:28:11 +00:00

pr-reviewer

Automated pull request review service for Forgejo. Receives webhook events, sends diffs to an LLM for review, and posts the review as a comment on the PR.

How it works

  1. A Forgejo webhook fires on PR open/synchronize/reopen/review_requested
  2. pr-reviewer determines the review tier:
    • Quick scan (always): focused on bugs, security issues, and breaking changes
    • Full review (when pr-reviewer-bot is assigned as reviewer): thorough analysis including full file contents for context
  3. A "working on it" comment is posted immediately with a timing estimate
  4. The diff (and file contents for full reviews) is sent to the configured LLM backend
  5. The pending comment is updated in-place with the review

After a full review is completed, the bot leaves the PR alone unless re-triggered by a new review_requested event or a comment mentioning @pr-reviewer-bot.

Configuration

All configuration is via environment variables:

Variable Description Default
FORGEJO_URL Forgejo base URL http://forgejo.forgejo.svc.cluster.local
FORGEJO_TOKEN API token for the bot user (required)
WEBHOOK_SECRET HMAC-SHA256 secret for webhook verification (required)
LLM_BACKEND anthropic or vllm anthropic
ANTHROPIC_API_KEY Anthropic API key (required if backend=anthropic)
VLLM_BASE_URL vLLM endpoint http://vllm.vllm.svc.cluster.local:8000/v1
ALLOWED_REPOS Comma-separated repo allowlist (empty = allow all) (empty)
BOT_USERNAME Bot's Forgejo username pr-reviewer-bot
DEFAULT_SETTLE_SECONDS Initial settle delay before committing to quick scan 5.0
MAX_SETTLE_SECONDS Ceiling for adaptive settle time 60.0
MAX_SETTLE_GAP_SECONDS Gaps beyond this aren't considered near-misses 300.0
QUICK_SCAN_MAX_TOKENS Max LLM output tokens for quick scans 2048
FULL_REVIEW_MAX_TOKENS Max LLM output tokens for full reviews 8192
DB_HOST, DB_PORT, DB_NAME, DB_USER, DB_PASSWORD PostgreSQL connection (from CNPG secret)

Endpoints

Webhook service (cmd/webhook)

Path Description
POST /webhook Forgejo webhook receiver
GET /health Health check

Dashboard (cmd/dashboard)

Path Description
GET / Landing page (login or summary, depending on auth state)
GET /reviews List of reviews visible to the current user
GET /reviews/{id} Per-review detail page
GET /admin/reviews All reviews across the system (admin only)
GET /admin/comparisons/{id} Side-by-side A/B comparison view (admin only)
GET /admin/configs Manage model configurations (admin only)
GET /health Health check

Setup

Forgejo bot user

Create a user (e.g. pr-reviewer-bot) with an API token that has:

  • read:repository
  • write:repository
  • write:issue

The bot must be added as a collaborator (write access) on each repo it reviews.

Per-repo webhook

In each repo's Settings > Webhooks, add:

  • URL: http://pr-reviewer.pr-reviewer.svc.cluster.local:8080/webhook
  • Content type: application/json
  • Secret: must match WEBHOOK_SECRET
  • Trigger: Pull Request events

Deployment

Deployed to Kubernetes via Flux from the infra repo (apps/pr-reviewer/). Two deployments share the same image:

  • pr-reviewer — webhook service (ClusterIP on 8080)
  • pr-reviewer-dashboard — read-only dashboard (MetalLB, serves at /)

Container images are built locally and pushed to Harbor at harbor.brooktrails.org/brooktrails/pr-reviewer.

Dashboard

An internal-only MetalLB service exposes the dashboard on the local network. Check kubectl -n pr-reviewer get svc pr-reviewer-dashboard for the assigned IP, then visit http://<ip>/.

Contributing

Changes to this repo go through branches and pull requests, not direct pushes to main. Use the following branch prefixes:

  • feat/ — new features
  • fix/ — bug fixes
  • refactor/ — restructuring without behavior changes
  • doc/ — documentation updates

The pr-reviewer bot reviews its own PRs.