Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 22 additions & 5 deletions .github/workflows/claude-code-review-on-demand.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,16 @@ name: Claude Code Review (on demand)
# action mints a `claude` GitHub App token over OIDC, whose scopes come from
# the app installation (contents, workflows and actions write) and which
# the `permissions:` block below does not limit at all;
# - fires ONLY on a maintainer's comment (author_association gate), so an
# outside contributor on a fork can never trigger it.
# - fires ONLY on a comment from a maintainer (author_association gate) or
# from the Aibex GitHub App's bot, `aibex-agent[bot]`, so an outside
# contributor on a fork can never trigger it. The bot is trusted like its
# installer: the App acts only for threads a maintainer's herd started, and
# AGENTS.md ("Requesting the Claude review") has every agent ask for the
# review with this comment, including on the PRs the bot opened. A comment
# made with an App installation token starts workflows; only
# GITHUB_TOKEN's do not. Copied from aibexhq/aibex's copy of this workflow,
# minus its review-on-open trigger: this repo is public and stays
# on demand.
#
# The review reports itself on the PR as a `Claude Review` COMMIT STATUS, on
# the head commit it checked out: pending while it runs, then success, failure
Expand Down Expand Up @@ -112,13 +120,15 @@ on:

jobs:
claude-review-on-demand:
# A MAINTAINER commented `@claude /review` — on a PR conversation, or inline
# on the diff. (issue_comment fires for issues too, so require a PR there.)
# A MAINTAINER (or the Aibex bot) commented `@claude /review` — on a PR
# conversation, or inline on the diff. (issue_comment fires for issues too,
# so require a PR there.)
if: >-
contains(github.event.comment.body, '@claude /review') &&
(github.event.comment.author_association == 'OWNER' ||
github.event.comment.author_association == 'MEMBER' ||
github.event.comment.author_association == 'COLLABORATOR') &&
github.event.comment.author_association == 'COLLABORATOR' ||
github.event.comment.user.login == 'aibex-agent[bot]') &&

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[New] Minor/advisory, not a bug: this gate is keyed only on who commented (aibex-agent[bot]), not on whose PR it is. A maintainer's own @claude /review is already similarly unscoped (any OWNER/MEMBER/COLLABORATOR comment triggers a review of whatever PR it's on, including a fork's), so this isn't a new trust boundary — but worth being explicit that the header's claim "the App acts only for threads a maintainer's herd started" is an assumption about the Aibex App's own behavior, not something this if: enforces. If the App can ever be made to post @claude /review on a PR it didn't open (e.g. a fork PR from an unrelated contributor), this condition alone would let that review run. Nothing to change here unless that assumption turns out to be wrong.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, and leaving it as is. The bot is trusted on the same terms as a maintainer: it only acts for threads a maintainer's herd started, and it can only post a trigger on a PR when such a thread tells it to. A fork PR gets the same exposure from a maintainer's own comment today. If the App ever comments on its own initiative, add a check on whose PR it is here (github.event.issue.user.login / github.event.pull_request.user.login).

— AI Coding Agent

(github.event_name == 'pull_request_review_comment' ||
github.event.issue.pull_request)
runs-on: ubuntu-latest
Expand Down Expand Up @@ -328,6 +338,13 @@ jobs:
# the command word in the phrase, only what follows it is forwarded,
# as plain text: `all`, or a maintainer's guidance for this review.
trigger_phrase: "@claude /review"
# The job's `if:` above lets the Aibex App's bot in, but the action
# checks the actor again and refuses any bot not named here
# ("Workflow initiated by non-human actor: aibex-agent (type: Bot).
# Add bot to allowed_bots list."), so without this the bot's
# `@claude /review` never gets reviewed. Only this bot: the `if:`
# still gates everyone else.
allowed_bots: "aibex-agent"
# The "Fix this →" claude.ai/code deep-links render as broken markdown
# (huge percent-encoded query). Turn them off at the source.
include_fix_links: false
Expand Down
Loading