[reviewer] Add phase-1 AI code reviewer#4022
Draft
brentvatne wants to merge 9 commits into
Draft
Conversation
Two-agent (correctness + security) AI code reviewer under tools/reviewer/, consolidated by a coordinator into one structured review. Runs in CI (comment-only, non-blocking) via .github/workflows/ai-review.yml and locally via `bun run review`. Built on Bun + the OpenCode SDK and fully isolated from eas-cli's yarn/lerna toolchain: its own package.json/bun.lock, excluded from root oxlint/oxfmt, and no imports from packages/. Also adds an /expo-review Claude Code command.
The SDK spawns `opencode` from PATH; CI only had the npm SDK. Pin opencode-ai as a dependency and run the CI step as a package script with node_modules/.bin on PATH so the binary resolves.
… from run log - handle is now let handle: OpencodeHandle | null = null with handle?.close() in finally (defensive; the flagged crash path was not actually reachable). - Run log records only baseRef/headRef, never author-controlled PR title/body, so secrets pasted into a PR description are not persisted to reviews.jsonl.
… ls-files - --base/--head now error clearly if given no value (or another flag). - Untracked-file listing uses git ls-files -z so filenames with newlines parse.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4022 +/- ##
=======================================
Coverage 60.57% 60.57%
=======================================
Files 955 955
Lines 42073 42073
Branches 8834 8834
=======================================
Hits 25480 25480
+ Misses 16499 16494 -5
- Partials 94 99 +5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…PR comment - Reviewers and coordinator now emit only critical/warning; core drops any stray suggestion and downgrades approve_with_comments to approve if nothing substantive remains. - Each finding gets a stable fingerprint (file + category + normalized title, line-independent), embedded hidden in the comment. - GitHubReporter now upserts one comment: updates the existing reviewer comment in place and deletes older duplicates, so re-reviews converge instead of posting a fresh comment each run.
Models occasionally return malformed/truncated JSON; a single run should not fail the whole review. promptAndParse re-prompts once with a corrective nudge in a fresh session before giving up.
This is the general Expo AI code reviewer, not eas-specific. Centralize the tag so the comment marker and embedded-fingerprint marker can't drift.
|
⏩ The changelog entry check has been skipped since the "no changelog" label is present. |
🤖 AI code reviewDecision: Approve Both specialist reviewers completed their analysis with no critical or warning-level findings. The PR is clean and ready to merge. No findings. Phase 1: comment-only. This review never blocks a merge and never auto-approves. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Phase 1 of an AI code reviewer for
eas-cli, per the internal spec. The goal is to prove the pipeline end-to-end and tune signal quality on real PRs before granting it any authority — so it runs comment-only / non-blocking: it never blocks a merge and never auto-approves.How
Adds a self-contained reviewer under
tools/reviewer/:src/core.ts) with swappable edges: a Source (GitHubPRSourcefor CI,LocalGitSourcefor local) and a Reporter (GitHubReporterposts one PR comment,TerminalReporterprints + exit code). CI and local produce identical findings from the same core..github/workflows/ai-review.yml, triggered onpull_request,continue-on-errorthroughout. Break-glass via a maintainer/skip-reviewcomment.cd tools/reviewer && bun run review [--staged | --base <ref> --head <ref> | --json | --no-fail]. Also exposed as an/expo-reviewClaude Code command.Built on Bun + the OpenCode SDK, fully isolated from eas-cli's yarn/lerna toolchain: its own
package.json/bun.lock, excluded from the root oxlint/oxfmt config, and no imports frompackages/(it only reads the repo as text). Structured for later extraction into a standaloneexpo/opencode-reviewerrepo.Two known phase-1 limitations are documented rather than fixed: CI runs PR-controlled code with secrets (mitigated for forks by
on: pull_requestwithholding secrets + the first-time-contributor approval gate; residual risk on trusted same-repo PRs), and the break-glass check reads only the most recent 100 comments.Test Plan
bunx tsc --noEmitintools/reviewer/passes.REVIEWER_MODEL=openai/gpt-5.4-mini-fast bun run review): server → 2 concurrent reviewers → coordinator → terminal report → exit code → JSONL log, ~3.5 min/run. It surfaced real findings (including in its own code, which were then fixed).--stagedshort-circuit (no changes →approve, exit 0, valid--json).🤖 Generated with Claude Code