Skip to content

About

Cloudflare Workers PR code reviewer supporting OpenCode Go primary and DeepSeek fallback.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

1 watching

Forks

Repository files navigation

AiPrReviewer

Zero-VPS, universal AI PR reviewer built with a platform-agnostic review-core and interchangeable adapters:

  • Cloudflare Workflows (adapters/cloudflare-workflow/): OpenCode primary deployments with DeepSeek fallback across 2 Cloudflare accounts, with zero per-repo workflow files.
  • Mac mini / Local CLI (adapters/local-cli/): private repository reviewer using the same trusted-receipt and provider-quorum rules as the Worker.

Review route

Codex and Claude subscription reviewers are opt-in only. Set CODEX_REVIEW_ENABLED=true or CLAUDE_REVIEW_ENABLED=true to enable one; unset or false keeps it off. auto is not a valid value and fails closed.

The API review chain is explicit: opencode is the primary reviewer and deepseek is the fallback. A primary-role deployment runs immediately. A fallback-role deployment waits FALLBACK_GRACE_MINUTES (default 10), then runs only when no trusted receipt for this exact head exists from another provider. When requiredProviders=2 (security-sensitive paths), a fallback-role deployment runs immediately because both independent receipts are required. The legacy secondary role has no grace window: it runs only when two providers are required and one is still missing.

[vars]
AI_REVIEW_PROVIDER = "opencode"
AI_REVIEW_PROVIDER_ROLE = "primary"
OPENCODE_MODEL = "replace-with-opencode-model"
REVIEWER_LOGIN = "qsl-opencode-reviewer[bot]"
TRUSTED_REVIEWERS_JSON = '{"qsl-ai-reviewer[bot]":["deepseek"]}'

OpenCode uses OPENCODE_BASE_URL (default https://opencode.ai/inference/go/openai/v1/chat/completions) and requires OPENCODE_MODEL; there is no default model. A model name containing deepseek is rejected so the primary and fallback remain distinct model families. Requests send User-Agent: pr-reviewer/1.0 and a stable x-opencode-session: ses_<sha256(repo|pr|head)[0:24]> header.

wrangler secret put OPENCODE_API_KEY -c wrangler.<org>-opencode.toml
wrangler secret put DEEPSEEK_API_KEY -c wrangler.<org>.toml

The DeepSeek configurations use AI_REVIEW_PROVIDER_ROLE = "fallback" and trust the matching OpenCode reviewer App. The deploy guard exposes the targets qsl-opencode, gdei-opencode, and pigbibi-opencode. Each target requires its own GitHub App ID variable (QSL_OPENCODE_GITHUB_APP_ID, GDEI_OPENCODE_GITHUB_APP_ID, or PIGBIBI_OPENCODE_GITHUB_APP_ID), App private key, webhook secret, and OPENCODE_API_KEY.

The Gemini reviewer deployments are retired; the Gemini provider code remains available but no target deploys it.

An explicit @<reviewer> review mention forces that App's provider to review the exact head even when another provider has already completed. It never duplicates its own existing receipt.

No API key belongs in TOML, repository variables, comments, or receipts. Keep provider credentials in Worker secrets or the local machine's secret store.

The local CLI also requires REVIEWER_LOGIN; it refuses to spend API credits when it cannot bind existing receipts to its own authenticated App identity. It accepts AI_REVIEW_PROVIDER=opencode with the same environment variables.

Verification

npm test

About

Cloudflare Workers PR code reviewer supporting OpenCode Go primary and DeepSeek fallback.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages