fix(ci): prevent self-cancelling AI review workflow

Root cause: Bot progress comments triggered issue_comment events,
which created new workflow runs with the same concurrency group,
causing cancel-in-progress to kill the original review.

Fixes:
1. Add event_name to concurrency group (prevents cross-event cancellation)
2. Explicit filter for ccs-agy-reviewer[bot] comments (belt-and-suspenders)

Closes race condition causing 25+ cancelled AI review runs.
This commit is contained in:
kaitranntt
2026-01-13 13:41:30 -05:00
parent 805ff64a7e
commit 120aca466d
+7 -4
View File
@@ -21,9 +21,10 @@ on:
required: true
type: string
# Cancel in-progress runs for same PR (safe now since auto-trigger is only on opened)
# Cancel in-progress runs for same PR + event type (prevents self-cancellation from bot comments)
# Each event type gets its own concurrency group to prevent cross-event cancellation
concurrency:
group: ai-review-${{ github.event.pull_request.number || github.event.issue.number || github.event.inputs.pr_number }}
group: ai-review-${{ github.event_name }}-${{ github.event.pull_request.number || github.event.issue.number || github.event.inputs.pr_number }}
cancel-in-progress: true
jobs:
@@ -38,14 +39,16 @@ jobs:
# Conditions:
# - PR event: only on opened (not synchronize to avoid cancel-on-push)
# - Comment event: only if it's a PR, contains /review, and NOT from a bot
# - Comment event: only if it's a PR, contains /review, NOT from a bot, and NOT from our review bot
# The explicit bot name check prevents self-triggering from progress comments
if: >
github.event_name == 'pull_request_target' ||
github.event_name == 'workflow_dispatch' ||
(github.event_name == 'issue_comment' &&
github.event.issue.pull_request &&
contains(github.event.comment.body, '/review') &&
github.event.comment.user.type != 'Bot')
github.event.comment.user.type != 'Bot' &&
github.event.comment.user.login != 'ccs-agy-reviewer[bot]')
# CLIProxy environment for model routing
env: