pr-reviewer/.env.example
Adam Moussa 15a52bff40
Add background auto-review worker with SQLite cache
Pre-compute PR reviews so they are ready the moment a PR is opened in
the queue, instead of waiting on an on-demand Fireworks call each time.

A daemon worker polls the queue every POLL_INTERVAL and reviews new or
changed non-draft PRs into a local SQLite cache (gitignored). Change
detection is two-level: skip when the PR's updated_at is unchanged, and
even when it moved, skip the model call when the diff's SHA-256 matches,
so comment-only bumps do not burn tokens. Failed reviews retry up to
MAX_REVIEW_ATTEMPTS with 429 backoff; departed PRs are closed with a
grace window before purge.

Singletons are initialized eagerly in the FastAPI lifespan before the
worker thread starts to avoid an init race; all cache writes are
serialized. New endpoints GET /api/reviews and POST /api/refresh back a
dashboard that polls for status (reviewing/ready/error) and opens a
ready review instantly. Nothing is posted automatically; the human
still decides. Stdlib-only, so no new runtime or test dependencies.
2026-07-01 14:28:11 -04:00

33 lines
1.2 KiB
Text

# --- GitHub ---
# Leave GITHUB_TOKEN blank to use your local `gh auth token` instead of a PAT.
GITHUB_TOKEN=
GITHUB_ORG=Sea-Haven-Industries
PR_SEARCH_FILTER=is:pr state:open archived:false sort:updated-desc org:Sea-Haven-Industries
MAX_PRS=100
MAX_DIFF_BYTES=120000
# --- Fireworks ---
FIREWORKS_API_KEY=fw_your_key_here
FIREWORKS_BASE_URL=https://api.fireworks.ai/inference/v1
# Coding-strong options: accounts/fireworks/models/deepseek-v4-pro
# accounts/fireworks/models/kimi-k2p6
FIREWORKS_MODEL=accounts/fireworks/models/deepseek-v4-pro
FIREWORKS_TEMPERATURE=0.2
FIREWORKS_MAX_TOKENS=4000
# --- Review behavior ---
# Comma-separated author logins to @-mention in the review body.
MENTION_AUTHORS=openswe
HOST=127.0.0.1
PORT=8765
# --- Background auto-review worker ---
# Seconds between poll cycles (pre-reviews new/changed non-draft PRs).
POLL_INTERVAL=300
# How many PRs to review in parallel per cycle (kept low to respect rate limits).
WORKER_CONCURRENCY=2
# Stop auto-retrying a PR that keeps failing until its diff changes.
MAX_REVIEW_ATTEMPTS=3
# SQLite cache path. Defaults to pr_cache.db in the repo root (gitignored).
# CACHE_DB=/absolute/path/to/pr_cache.db