Skip to content

feat(agentic): scaffold Code Review Action trigger (NOP)#13167

Merged
mekarpeles merged 2 commits into
masterfrom
13163/code-review-action-scaffold
Jul 16, 2026
Merged

feat(agentic): scaffold Code Review Action trigger (NOP)#13167
mekarpeles merged 2 commits into
masterfrom
13163/code-review-action-scaffold

Conversation

@mekarpeles

@mekarpeles mekarpeles commented Jul 15, 2026

Copy link
Copy Markdown
Member

Summary

Scaffolds the trigger wiring for the Code Review Action (#13163) without the actual review logic, which is still blocked on research (how Copilot structures inline review comments, whether claude-code-action supports the GitHub Review API's comments[] natively). This lets the trigger paths get verified independently of that work.

Does not close #13163 — this is deliberately just the trigger scaffold.

Design

Split into two workflows:

auto_assign_reviewer.yml — requests @openlibrary-bot as a reviewer on any non-draft PR (opened, or moved out of draft) that doesn't already have one requested or reviewed. Skips PRs openlibrary-bot itself authored.

code_review_action.yml — the actual trigger + (currently NOP) review, reachable via three paths:

  1. review_requested with openlibrary-bot as the reviewer — covers both a human manually requesting it and auto_assign_reviewer.yml's automated request. No staff check needed here: requesting any reviewer already requires write/triage access on GitHub's side.
  2. opened / ready_for_review where the PR's own author is openlibrary-bot — see note below.
  3. issue_comment @-mention on a PR — open to anyone who can comment, so this path keeps an explicit staff allowlist (mirrors pr_autoresponder.yml / issue_enrichment.md).

Draft PRs never trigger a review on any path — checked at the workflow if: level where the event payload has a draft field, and defensively re-checked inside the job itself for the one path (issue_comment) whose payload doesn't carry it.

Note on self-authored PRs: GitHub's API rejects requesting a PR's own author as a reviewer (422). So "add openlibrary-bot as a reviewer on its own PR" isn't literally possible — code_review_action.yml's direct opened/ready_for_review trigger for pull_request.user.login == 'openlibrary-bot' is the substitute: it skips the reviewer-request step entirely and goes straight to triggering review.

Idempotency guard: code_review_action.yml checks for its own <!-- ol-pr-review-bot --> marker before posting, since a PR can reach it through more than one overlapping path (e.g. opened → auto-assign → review_requested).

Testing

  • pre-commit run passes on both files.
  • Not yet exercised against a live PR — recommend testing all three paths once merged (open a non-draft PR from a non-bot account, convert a draft to ready, and open one from openlibrary-bot itself) before building the review logic on top.

Related

Wires up both trigger paths for #13163 -- requesting @openlibrary-bot
as a PR reviewer, and @-mentioning it in a PR comment -- staff-gated
on both. No review logic yet; posts a placeholder comment confirming
the trigger fired so the untested event wiring (review_requested,
staff-only issue_comment on a PR) can be verified independently of
the review-generation work, which is still blocked on research.

Plain actions/github-script, no claude-code-action -- avoids the
permission-bypass and ref-resolution-lag issues found in #13161
until real review logic actually needs an LLM.
… and self-authored PRs

Splits the scaffold into two workflows:
- auto_assign_reviewer.yml: requests openlibrary-bot as reviewer on
  any non-draft PR that doesn't already have one, opened or moved
  out of draft. Skips PRs openlibrary-bot itself authored.
- code_review_action.yml: fires on review_requested (manual or
  auto-assigned), on opened/ready_for_review when openlibrary-bot is
  the PR's own author, and on staff-only @-mentions. Still a NOP
  placeholder -- no review logic yet.

Draft PRs never trigger a review on any path, including a defensive
in-job check for the paths whose event payload has no draft field.

GitHub rejects requesting a PR's own author as a reviewer (422), so
self-authored PRs can't go through the normal request-reviewer path
-- code_review_action.yml's own opened/ready_for_review trigger is
the direct substitute for that case.
@mekarpeles mekarpeles merged commit 5aa48e6 into master Jul 16, 2026
8 checks passed
@mekarpeles mekarpeles deleted the 13163/code-review-action-scaffold branch July 16, 2026 04:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Code Review Action: openlibrary-bot-driven PR review (Copilot replacement)

1 participant