fix(pr-monitor): CodeRabbit 発イベントで backstop が actor 拒否される不具合を修正 (allowed_bots)#260
fix(pr-monitor): CodeRabbit 発イベントで backstop が actor 拒否される不具合を修正 (allowed_bots)#260aloekun wants to merge 2 commits into
Conversation
…wed_bots)
WP-09 の GitHub Actions バックストップの本命トリガー (CodeRabbit のレビュー完了 =
pull_request_review / walkthrough = issue_comment、actor が coderabbitai[bot]) が、
claude-code-action の非人間 actor 拒否 ("Workflow initiated by non-human actor:
coderabbitai") で常に失敗していた (PR #259 の pull_request_review run で実観測)。
#258 のスモークテストが通ったのは actor が人間 (pull_request opened) だったため、
本命トリガーの障害を見逃していた。
- action step に allowed_bots: "coderabbitai[bot]" を追加し当該 bot のみ許可 ("*" 不使用)。
- allowlist した bot は GitHub 権限チェックをバイパスする (公式 docs/security.md) ため、
本 job の安全性は読み取り専用多層防御が唯一の担保になる点をコメントで明記 (ADR-022 原則6)。
- 副次効果: github-actions[bot] は allowlist 外のため自己トリガーが二重に防止される。
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughPR監視ワークフローの Claude Code Action に ChangesPR監視ワークフロー
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…w_dispatch) pr-monitor の run が PR の Status Check として現れ、concurrency cancel や bot-actor 失敗が CI 失敗 (赤× / UNSTABLE) に見える問題を解消する (PR #260 の analyze run cancelled で実観測)。原因: check_run はイベントごとに異なる対象 SHA へ発行され、pull_request 起点の run のみ PR head SHA に紐づき PR チェック化する。CodeRabbit が数分でレビューを返すため opened run が review イベントで concurrency cancel され、cancelled が赤× として残る (ほぼ毎 PR で必然)。監視 ≠ CI として役割ベースでトリガーを分離: pull_request(opened/ready) 削除、pull_request_review/issue_comment 維持、workflow_dispatch(input pr_number) 追加、allowed_bots 維持、PR番号解決を 3 箇所で inputs.pr_number 対応。ADR-022 原則6 のトリガー記述を更新。
概要
WP-09(PR #258 でマージ済み)の GitHub Actions バックストップの本命トリガーが常に失敗していた不具合を修正する。
不具合
claude-code-action は既定でトリガー元 actor の権限を検査し、bot actor を拒否する。バックストップの本命トリガー(CodeRabbit のレビュー完了 =
pull_request_review、walkthrough =issue_comment)は actor がcoderabbitai[bot]のため、以下のエラーで常に失敗していた:PR #259 の
pull_request_reviewrun(run 29149352791)で実観測。PR #258 のスモークテストが通ったのはpull_request: openedの actor が人間(リポジトリ owner)で権限チェックを通過したためで、本命トリガー(bot 発)の障害を見逃していた。修正
action step に
allowed_bots: "coderabbitai[bot]"を追加し、この bot のみを許可("*"は使わず、任意 bot トリガーは禁止)。セキュリティ上の注意(workflow にコメントで明記)
公式 docs/security.md: 「Allowed bots are not checked for repository permissions」 — allowlist した bot は GitHub の権限チェックを完全にバイパスする。したがって本 job の安全性は、pre-push security review が PR #258 で確立した読み取り専用の多層防御(
permissions: contents: read/allowedToolsscope / エージェント無 write /persist-credentials: false)が唯一の担保になる(ADR-022 原則6 の 2 不変条件)。GitHub の権限ゲートに頼れないぶん、この多層防御の重要性が増す。副次効果:
github-actions[bot](本 workflow 自身の投稿者)は allowlist 外のため bot トリガーが弾かれ、自己トリガーが二重に防止される。検証(マージ後に有効化)
GitHub の仕様上、
pull_request_review/issue_commentトリガーはデフォルトブランチ(master)上の workflow 定義で発火する。したがって本修正は master にマージされて初めて有効化される:pull_request_review)は master の旧定義(allowed_bots 無し)で動くため、依然として actor 拒否で失敗する(想定内。regression ではない)。YAML 構文 +
allowed_botsの反映は確認済み。変更
.github/workflows/pr-monitor.yml— action step にallowed_bots追加 + 設計 / セキュリティコメントWP-09 の受け入れ基準「セッション閉鎖中の CodeRabbit レビュー完了に無人で分析コメント」は、この修正で初めて成立する。
Summary by CodeRabbit