From d9e6b0a8da439f1caa5cc42aa99a23f83f59241b Mon Sep 17 00:00:00 2001 From: Chaitanya Kale Date: Tue, 6 Oct 2026 11:22:32 -0400 Subject: [PATCH 1/4] chore(ci): migrate PR review to the shared review harness (v2) Replace the standalone claude-code-action review workflow with the canonical caller stub for the shared harness, pinned to @v2, with verdict_policy: deterministic. Co-Authored-By: Claude Sonnet 5.5 --- .github/workflows/claude-code-review.yml | 128 ----------------------- .github/workflows/code-review.yml | 23 ++++ 2 files changed, 23 insertions(+), 128 deletions(-) delete mode 100644 .github/workflows/claude-code-review.yml create mode 100644 .github/workflows/code-review.yml diff --git a/.github/workflows/claude-code-review.yml b/.github/workflows/claude-code-review.yml deleted file mode 100644 index 87f1cfa..0000000 --- a/.github/workflows/claude-code-review.yml +++ /dev/null @@ -1,128 +0,0 @@ -name: Claude Code Review - -on: - pull_request: - types: [opened, synchronize, ready_for_review, reopened] - issue_comment: - types: [created] - pull_request_review_comment: - types: [created] - pull_request_review: - types: [submitted] - -permissions: - contents: read - pull-requests: write - issues: read - id-token: write - -jobs: - review: - if: | - (github.event_name == 'pull_request' && github.event.pull_request.draft == false && github.event.pull_request.merged == false) || - (github.event_name == 'issue_comment' && github.event.issue.pull_request && contains(github.event.comment.body, '@claude')) || - (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) || - (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) - concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.issue.number || github.run_id }} - cancel-in-progress: ${{ github.event_name == 'pull_request' }} - runs-on: ubuntu-latest - steps: - - name: Resolve PR number - id: pr - run: | - if [ "${{ github.event_name }}" = "issue_comment" ]; then - echo "number=${{ github.event.issue.number }}" >> "$GITHUB_OUTPUT" - else - echo "number=${{ github.event.pull_request.number }}" >> "$GITHUB_OUTPUT" - fi - - - name: Checkout repository - uses: actions/checkout@v7 - with: - ref: refs/pull/${{ steps.pr.outputs.number }}/head - fetch-depth: 0 - - - name: Fetch PR diff - env: - GH_TOKEN: ${{ github.token }} - run: | - gh pr diff "${{ steps.pr.outputs.number }}" > /tmp/pr-diff.patch - - - name: Fetch previous reviews - env: - GH_TOKEN: ${{ github.token }} - run: | - PR_NUM="${{ steps.pr.outputs.number }}" - REPO="${{ github.repository }}" - { - echo "=== Review Summaries ===" - gh api "repos/${REPO}/pulls/${PR_NUM}/reviews" --paginate \ - --jq '.[] | select(.state != "PENDING") | "[\(.user.login)] \(.state)\n\(.body)\n---"' 2>/dev/null || true - - echo "" - echo "=== Inline Review Comments ===" - gh api "repos/${REPO}/pulls/${PR_NUM}/comments" --paginate \ - --jq '.[] | "[\(.user.login)] \(.path):\(.line // .original_line)\n\(.body)\n---"' 2>/dev/null || true - - echo "" - echo "=== PR Conversation Comments ===" - gh api "repos/${REPO}/issues/${PR_NUM}/comments" --paginate \ - --jq '.[] | "[\(.user.login)]\n\(.body)\n---"' 2>/dev/null || true - } > /tmp/previous-reviews.txt - - - name: Build review prompt - id: prompt - run: | - DELIMITER="PROMPT_EOF_$(uuidgen)" - { - echo "REVIEW_PROMPT<<${DELIMITER}" - for f in CLAUDE.md AGENTS.md; do - if [ -f "$f" ]; then - cat "$f" - echo "" - fi - done - if [ -f ".claude/review-prompt.md" ]; then - cat .claude/review-prompt.md - fi - echo "${DELIMITER}" - } >> "$GITHUB_OUTPUT" - - - name: Resolve claude_args - id: args - env: - MODEL: ${{ vars.CLAUDE_REVIEW_MODEL }} - run: | - ALLOWED_TOOLS='Read,Glob,Grep,mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr view:*)' - if [ -n "$MODEL" ]; then - echo "value=--model ${MODEL} --max-turns 10 --allowedTools \"${ALLOWED_TOOLS}\"" >> "$GITHUB_OUTPUT" - else - echo "value=--max-turns 10 --allowedTools \"${ALLOWED_TOOLS}\"" >> "$GITHUB_OUTPUT" - fi - - - name: Claude Code Review - continue-on-error: true - uses: anthropics/claude-code-action@v1 - with: - anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} - allowed_bots: "custom-ink-triton" - prompt: | - You are reviewing PR #${{ steps.pr.outputs.number }}. - The full diff is in /tmp/pr-diff.patch — Read that file first. - Previous review comments are in /tmp/previous-reviews.txt — Read that file next. - Do NOT run gh pr diff or git diff to re-fetch it. - Use Read on source files if you need more context beyond the diff. - - IMPORTANT: Do NOT repeat or reiterate feedback that has already been given - in previous reviews. If a prior reviewer (human or bot) already flagged an - issue and the author has not addressed it in the current diff, you may - reference it briefly but do not re-explain. Focus your review on NEW issues - not covered by prior feedback. - - Post inline review comments and stop. - - Review this pull request using the following guidelines: - - ${{ steps.prompt.outputs.REVIEW_PROMPT }} - claude_args: "${{ steps.args.outputs.value }}" diff --git a/.github/workflows/code-review.yml b/.github/workflows/code-review.yml new file mode 100644 index 0000000..31b49a2 --- /dev/null +++ b/.github/workflows/code-review.yml @@ -0,0 +1,23 @@ +name: Claude PR Review + +on: + pull_request: + types: [opened, synchronize, ready_for_review, reopened, closed] + +permissions: + actions: read + contents: read + pull-requests: write + issues: write + +jobs: + review: + uses: customink/agent-first-standards/.github/workflows/pr-review.yml@v2 + with: + verdict_policy: deterministic + secrets: + ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} + CUSTOM_INK_CODE_REVIEW_APP_ID: ${{ secrets.CUSTOM_INK_CODE_REVIEW_APP_ID }} + CUSTOM_INK_CODE_REVIEW_PRIVATE_KEY: ${{ secrets.CUSTOM_INK_CODE_REVIEW_PRIVATE_KEY }} + NEW_RELIC_ACCOUNT_ID: ${{ secrets.NEW_RELIC_ACCOUNT_ID }} + NEW_RELIC_INSERT_KEY: ${{ secrets.NEW_RELIC_INSERT_KEY }} From 1c9dc14dd6e425c923da066ccdd79931ca045a11 Mon Sep 17 00:00:00 2001 From: Chaitanya Kale Date: Tue, 6 Oct 2026 11:23:14 -0400 Subject: [PATCH 2/4] chore(ci): drop reviewer-behavior line from review prompt The shared review harness base prompt owns review behavior, so the 'only comment when actionable' line restates it. Co-Authored-By: Claude Sonnet 5.5 --- .claude/review-prompt.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/.claude/review-prompt.md b/.claude/review-prompt.md index 5f448d1..e99b365 100644 --- a/.claude/review-prompt.md +++ b/.claude/review-prompt.md @@ -2,8 +2,6 @@ You are reviewing pull requests for moqueue. Apply the project rules from CLAUDE.md/AGENTS.md (loaded separately) in addition to this guidance. -**Only comment when you have actionable feedback. Never post "looks good", "no issues found", or summary-only comments.** - ## What to Evaluate - **Correctness**: the change should solve the stated problem, handle edge cases, and be free of bugs and regressions. From aed046ed4cafff3f42e38f071ec804bc98230e55 Mon Sep 17 00:00:00 2001 From: Chaitanya Kale Date: Tue, 6 Oct 2026 12:23:51 -0400 Subject: [PATCH 3/4] chore(ci): drop "post nothing if the PR looks good" bullet from review prompt The harness posts an APPROVE verdict for a clean review under verdict_policy: deterministic, so a repo-prompt instruction to post no comment at all on a clean PR conflicts with it. Co-Authored-By: Claude Sonnet 5.5 --- .claude/review-prompt.md | 1 - 1 file changed, 1 deletion(-) diff --git a/.claude/review-prompt.md b/.claude/review-prompt.md index e99b365..bd871e2 100644 --- a/.claude/review-prompt.md +++ b/.claude/review-prompt.md @@ -35,5 +35,4 @@ Categorize each finding: - Group related issues into a single review comment - Reference specific lines using GitHub line-link format - Skip auto-generated files (lockfiles, codegen output, Vite build artifacts) -- If the entire PR looks good, do not post a comment at all - Read all previous review comments before posting. Do not repeat feedback that has already been given — whether by a human reviewer or a prior bot review. If a previous comment flagged an issue and it remains unfixed, you may briefly note it persists but do not re-explain. From 593ff35c60ea44c8b8b0305f6b0c1126321a8d73 Mon Sep 17 00:00:00 2001 From: Chaitanya Kale Date: Tue, 6 Oct 2026 14:02:18 -0400 Subject: [PATCH 4/4] chore(ci): trim review prompt to defer to the shared harness The base prompt already owns severity tiers, review behavior, confidence scoring, previous-review handling and generated-file filtering. This prompt was an unmodified template with no repo-specific rules, and parts of it (Critical/Question severities, "phrase uncertainty as a question") conflict with the base prompt, so only the heading and intro remain. Co-Authored-By: Claude Sonnet 5.5 --- .claude/review-prompt.md | 35 ----------------------------------- 1 file changed, 35 deletions(-) diff --git a/.claude/review-prompt.md b/.claude/review-prompt.md index bd871e2..8b4253f 100644 --- a/.claude/review-prompt.md +++ b/.claude/review-prompt.md @@ -1,38 +1,3 @@ # Claude Code Review Prompt You are reviewing pull requests for moqueue. Apply the project rules from CLAUDE.md/AGENTS.md (loaded separately) in addition to this guidance. - -## What to Evaluate - -- **Correctness**: the change should solve the stated problem, handle edge cases, and be free of bugs and regressions. -- **Code quality, readability, and maintainability**: the change should be clean, easy to follow, and sustainable to maintain and modify. -- **Conventions**: the change should follow this repo's existing patterns and conventions. It should avoid introducing or perpetuating anti-patterns. Do not re-teach language basics — ground convention feedback in what this codebase actually does. -- **Performance**: the change should avoid N+1 queries, excess API calls, unnecessary re-renders, unbounded list operations, and avoidable complexity. -- **Security**: the change should validate and sanitize inputs, enforce authentication and authorization correctly, protect sensitive data, and avoid common web security risks. -- **Testing**: the change should include coverage for changed behavior, failure modes, and important edge cases. Tests should assert meaningful behavior, not just exercise code. -- **Design, architecture, and scope**: the change should be well-designed, make worthwhile tradeoffs, fit the rest of the codebase cleanly, and remain reasonably scoped. -- **Dependencies**: any added library should be necessary and used appropriately. - -## Findings - -Categorize each finding: - -- **Critical**: broken behavior, likely regressions, data loss, security issues, missing authorization, or defects that should block merge -- **Suggestion**: meaningful improvements to correctness, resilience, performance, maintainability, or test coverage -- **Nit**: minor style or readability feedback that is clearly optional -- **Question**: uncertainty about intent, tradeoffs, or missing context - -## PR Context - -- Link to the project pitch or Jira ticket in the PR body when applicable - -## Review Behavior - -- Focus on issues that matter. Do not pad the review with trivial comments. -- Explain what is wrong, why it matters, and suggest a concrete fix when possible. If unsure, say so and phrase it as a question. -- Flag change hygiene issues when unrelated changes are mixed in or the work should be split into smaller reviewable pieces. -- Call out genuinely good choices when they are specific and notable. -- Group related issues into a single review comment -- Reference specific lines using GitHub line-link format -- Skip auto-generated files (lockfiles, codegen output, Vite build artifacts) -- Read all previous review comments before posting. Do not repeat feedback that has already been given — whether by a human reviewer or a prior bot review. If a previous comment flagged an issue and it remains unfixed, you may briefly note it persists but do not re-explain.